manifests/collectors/Monitor/LAWorkspaceLinkedServices.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Monitor/LAWorkspaceLinkedServices.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 = @(
        'AZSC/ARMChild/LAWorkspaceLinkedServices'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ws = $Resources | Where-Object { $_.id -eq $1.PARENTID } | Select-Object -First 1
            $sub1 = $SUB | Where-Object { $_.Id -eq $1.subscriptionId }
            $ResUCount = 1
            $props = $1.properties

            $linkedResId = if ($props.resourceId) { $props.resourceId } else { 'N/A' }
            $writeResId = if ($props.writeAccessResourceId) { $props.writeAccessResourceId } else { 'N/A' }
            $linkedResName = if ($linkedResId -ne 'N/A') { ($linkedResId -split '/')[-1] } else { 'N/A' }
            $linkedResType = if ($linkedResId -ne 'N/A' -and $linkedResId -match '/providers/([^/]+/[^/]+)/') {
                $matches[1]
            } else { 'N/A' }
'@


    AdditionalRowLoops = @()

    TagLoop = $null

    Fields = @(
        @{
            Name = 'Workspace Name'
            Expression = '$ws.NAME'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'Resource Group'
            Expression = '$ws.RESOURCEGROUP'
        }
        @{
            Name = 'Linked Service Name'
            Expression = '($1.name -split ''/'')[-1]'
        }
        @{
            Name = 'Linked Resource Name'
            Expression = '$linkedResName'
        }
        @{
            Name = 'Linked Resource Type'
            Expression = '$linkedResType'
        }
        @{
            Name = 'Linked Resource ID'
            Expression = '$linkedResId'
        }
        @{
            Name = 'Write Access Resource ID'
            Expression = '$writeResId'
        }
        @{
            Name = 'Provisioning State'
            Expression = 'if ($props.provisioningState) { $props.provisioningState } else { ''N/A'' }'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = ''''''
        }
        @{
            Name = 'Tag Value'
            Expression = ''''''
        }
    )

    Export = @{
        WorksheetName = 'LA Linked Services'
        TableNamePrefix = 'LALinkedSvcTable_'
        Columns = @(
            'Workspace Name'
            'Subscription'
            'Resource Group'
            'Linked Service Name'
            'Linked Resource Name'
            'Linked Resource Type'
            'Provisioning State'
            'Resource U'
        )
        TagColumns = @()
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Monitor/LAWorkspaceLinkedServices.ps1'
}