manifests/collectors/Identity/ManagedIdentities.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Identity/ManagedIdentities.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 = @(
        'entra/managedidentities'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
            $data = $1.properties
 
            # Determine type from alternativeNames
            $miType = 'Unknown'
            $associatedResource = ''
            if ($data.alternativeNames) {
                $altNames = @($data.alternativeNames)
                if ($altNames -match 'isExplicit=True') {
                    $miType = 'User-Assigned'
                }
                else {
                    $miType = 'System-Assigned'
                }
                # The resource URI is typically the second alternative name
                $resourceUri = $altNames | Where-Object { $_ -match '^/subscriptions/' -or $_ -match '^/providers/' }
                if ($resourceUri) {
                    $associatedResource = ($resourceUri | Select-Object -First 1)
                }
            }
'@


    AdditionalRowLoops = @()

    TagLoop = $null

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$1.id'
        }
        @{
            Name = 'Tenant ID'
            Expression = '$1.tenantId'
        }
        @{
            Name = 'Display Name'
            Expression = '$data.displayName'
        }
        @{
            Name = 'Application ID'
            Expression = '$data.appId'
        }
        @{
            Name = 'Identity Type'
            Expression = '$miType'
        }
        @{
            Name = 'Associated Resource'
            Expression = '$associatedResource'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
    )

    Export = @{
        WorksheetName = 'Managed Identities'
        TableNamePrefix = 'ManagedIdsTable_'
        Columns = @(
            'Display Name'
            'Application ID'
            'Identity Type'
            'Associated Resource'
            'Resource U'
        )
        TagColumns = @()
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

    SourceCollector = 'Modules/Public/InventoryModules/Identity/ManagedIdentities.ps1'
}