manifests/collectors/Identity/PIMAssignments.psd1

#
# GENERATED by scripts/ConvertTo-ScoutCollectorDefinition.ps1 from Modules/Public/InventoryModules/Identity/PIMAssignments.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/pimassignments'
    )

    ResourceTypeMatching = 'Grouped'

    AdditionalFilter = $null

    FilterPreamble = ''

    RowLoopVariable = '1'

    Preamble = @'
$ResUCount = 1
            $data = $1.properties
 
            # Extract expanded principal and role definition names
            $principalName = ''
            $principalType = ''
            if ($data.principal) {
                $principalName = $data.principal.displayName
                if ($data.principal.'@odata.type') {
                    $principalType = $data.principal.'@odata.type' -replace '#microsoft\.graph\.', ''
                }
            }
 
            $roleName = ''
            if ($data.roleDefinition) {
                $roleName = $data.roleDefinition.displayName
            }
'@


    AdditionalRowLoops = @()

    TagLoop = $null

    Fields = @(
        @{
            Name = 'ID'
            Expression = '$data.id'
        }
        @{
            Name = 'Tenant ID'
            Expression = '$1.tenantId'
        }
        @{
            Name = 'Principal Name'
            Expression = '$principalName'
        }
        @{
            Name = 'Principal ID'
            Expression = '$data.principalId'
        }
        @{
            Name = 'Principal Type'
            Expression = '$principalType'
        }
        @{
            Name = 'Role Name'
            Expression = '$roleName'
        }
        @{
            Name = 'Role Definition ID'
            Expression = '$data.roleDefinitionId'
        }
        @{
            Name = 'Directory Scope'
            Expression = '$data.directoryScopeId'
        }
        @{
            Name = 'Resource U'
            Expression = '$ResUCount'
        }
    )

    Export = @{
        WorksheetName = 'PIM Assignments'
        TableNamePrefix = 'PIMTable_'
        Columns = @(
            'Principal Name'
            'Principal Type'
            'Role Name'
            'Principal ID'
            'Role Definition ID'
            'Directory Scope'
            'Resource U'
        )
        TagColumns = @()
        TagColumnsBefore = $null
        NumberFormat = '0'
        ConditionalText = @()
    }

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