manifests/collectors/Hybrid/ArcSQLServers.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Hybrid/ArcSQLServers.ps1 (AB#5660).
# Field expressions are copied verbatim from the original collector and evaluate in an
# equivalent scope -- see docs/design/decisions/declarative-collectors.md.
# Review before trusting; regenerate rather than hand-patch if the source collector changes.
#
@{
    ResourceTypes = @(
        'microsoft.azurearcdata/sqlserverinstances'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
            $sub1 = $SUB | Where-Object { $_.Id -eq $1.subscriptionId }
            $data = $1.PROPERTIES
            $Tags = if (![string]::IsNullOrEmpty($1.tags.psobject.properties)) { $1.tags.psobject.properties } else { '0' }
'@


    AdditionalRowLoops = @()

    TagLoop = @{
        Variable = 'Tag'
        Source = '$Tags'
        Preamble = ''
    }

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'Resource Group'
            Expression = '$1.RESOURCEGROUP'
        }
        @{
            Name = 'Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'Host Machine Name'
            Expression = 'if ($data.hostType) { $data.hostType } else { if ($data.azureDefenderStatus) { ''N/A'' } else { ''N/A'' } }'
        }
        @{
            Name = 'SQL Version'
            Expression = 'if ($data.version) { $data.version } else { ''N/A'' }'
        }
        @{
            Name = 'Edition'
            Expression = 'if ($data.edition) { $data.edition } else { ''N/A'' }'
        }
        @{
            Name = 'Licensing Type'
            Expression = 'if ($data.licenseType) { $data.licenseType } else { ''N/A'' }'
        }
        @{
            Name = 'vCores'
            Expression = 'if ($data.vCore) { $data.vCore } else { ''N/A'' }'
        }
        @{
            Name = 'Patch Level'
            Expression = 'if ($data.patchLevel) { $data.patchLevel } else { ''N/A'' }'
        }
        @{
            Name = 'Collation'
            Expression = 'if ($data.collation) { $data.collation } else { ''N/A'' }'
        }
        @{
            Name = 'Container Resource ID'
            Expression = 'if ($data.containerResourceId) { ($data.containerResourceId -split ''/'')[-1] } else { ''N/A'' }'
        }
        @{
            Name = 'Azure Defender Status'
            Expression = 'if ($data.azureDefenderStatus) { $data.azureDefenderStatus } else { ''N/A'' }'
        }
        @{
            Name = 'Azure Defender Update Time'
            Expression = 'if ($data.azureDefenderStatusLastUpdated) { ([datetime]$data.azureDefenderStatusLastUpdated).ToString(''yyyy-MM-dd'') } else { ''N/A'' }'
        }
        @{
            Name = 'Provisioning State'
            Expression = 'if ($data.provisioningState) { $data.provisioningState } else { ''N/A'' }'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'Arc SQL Servers'
        TableNamePrefix = 'ArcSQLServersTable_'
        Columns = @(
            'Subscription'
            'Resource Group'
            'Name'
            'Location'
            'SQL Version'
            'Edition'
            'Licensing Type'
            'vCores'
            'Patch Level'
            'Collation'
            'Container Resource ID'
            'Azure Defender Status'
            'Azure Defender Update Time'
            'Provisioning State'
            'Resource U'
        )
        TagColumns = @(
            'Tag Name'
            'Tag Value'
        )
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Hybrid/ArcSQLServers.ps1'
}