manifests/collectors/Compute/AVDAzureLocal.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Compute/AVDAzureLocal.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/AVD/AzureLocalSessionHost'
    )

    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 { [pscustomobject]@{ Name = ''; Value = '' } }
 
            $hostPool = if ($1._HostPool) { $1._HostPool } elseif ($data.hostPoolId) { ($data.hostPoolId -split '/')[-1] } else { Get-AZSCSafeProperty -InputObject $1.tags -Path 'HostPool' }
            $arcVersion = if ($data.agentVersion) { $data.agentVersion } else { $data.agentversion }
            $osVersion = if ($data.osVersion) { $data.osVersion } else { $data.osversion }
            $hciCluster = if ($1._Platform -eq 'AzureLocal') {
                # Walk up the resource ID to find the HCI cluster name
                if ($1.id) { ($1.id -split '/')[8] } else { 'N/A' }
            } else { 'N/A' }
 
            $hbRaw = $data.lastStatusChange
            $heartbeat = if ($hbRaw) { try { ([datetime]$hbRaw).ToString('yyyy-MM-dd HH:mm') } catch { $hbRaw } } else { 'N/A' }
'@


    AdditionalRowLoops = @()

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

    Fields = @(
        @{
            Name = 'Name'
            Expression = '$1.NAME'
        }
        @{
            Name = 'Subscription'
            Expression = '$sub1.Name'
        }
        @{
            Name = 'Resource Group'
            Expression = '$1.RESOURCEGROUP'
        }
        @{
            Name = 'Location'
            Expression = '$1.LOCATION'
        }
        @{
            Name = 'Platform'
            Expression = '$1._Platform'
        }
        @{
            Name = 'Host Pool'
            Expression = 'if ($hostPool) { $hostPool } else { ''N/A'' }'
        }
        @{
            Name = 'Status'
            Expression = 'if ($data.status) { $data.status } else { ''N/A'' }'
        }
        @{
            Name = 'Agent Version'
            Expression = 'if ($arcVersion) { $arcVersion } else { ''N/A'' }'
        }
        @{
            Name = 'Last Heartbeat'
            Expression = '$heartbeat'
        }
        @{
            Name = 'OS Version'
            Expression = 'if ($osVersion) { $osVersion } else { ''N/A'' }'
        }
        @{
            Name = 'Azure Local Cluster'
            Expression = '$hciCluster'
        }
        @{
            Name = 'Allow New Session'
            Expression = 'if ($data.allowNewSession -ne $null) { $data.allowNewSession } else { ''N/A'' }'
        }
        @{
            Name = 'Assigned User'
            Expression = 'if ($data.assignedUser) { $data.assignedUser } else { ''N/A'' }'
        }
        @{
            Name = 'Sessions'
            Expression = 'if ($data.sessions -ne $null) { $data.sessions } else { 0 }'
        }
        @{
            Name = 'Resource ID'
            Expression = 'if ($1._VmId) { $1._VmId } else { $1.id }'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
        @{
            Name = 'Tag Name'
            Expression = '[string]$Tag.Name'
        }
        @{
            Name = 'Tag Value'
            Expression = '[string]$Tag.Value'
        }
    )

    Export = @{
        WorksheetName = 'AVD on Azure Local Arc'
        TableNamePrefix = 'AVDAzureLocalTable_'
        Columns = @(
            'Name'
            'Subscription'
            'Resource Group'
            'Location'
            'Platform'
            'Host Pool'
            'Status'
            'Agent Version'
            'Last Heartbeat'
            'OS Version'
            'Azure Local Cluster'
            'Allow New Session'
            'Assigned User'
            'Sessions'
            'Resource ID'
            'Resource U'
        )
        TagColumns = @()
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Compute/AVDAzureLocal.ps1'
}