Get-MgCustomSecurityAttributeInfo
SYNOPSIS
Reports custom security attributes assigned to users, devices, and service principals (enterprise apps) in Microsoft Entra ID.SYNTAX
DESCRIPTION
Queries Microsoft Graph to enumerate custom security attribute assignments across users, devices, and service principals. Auto-discovers all attribute sets in the tenant, or restricts the scope to a single set when -AttributeSet is provided. The output is one row per (entity, attribute set, attribute name, value) so it can be filtered/pivoted easily.EXAMPLES
EXAMPLE 1
EXAMPLE 2
EXAMPLE 3
EXAMPLE 4
EXAMPLE 5
PARAMETERS
-AttributeSet
Restricts the report to a single attribute set name. If omitted, all attribute sets discovered in the tenant are reported.-EntityType
Limits the entity types scanned. Valid values: User, Device, ServicePrincipal. Default is all three.-ExportPath
Optional output directory for the Excel export (defaults to the user profile).-ExportToExcel
(Optional) If specified, exports the results to an Excel file in the user’s profile directory.-ForceNewToken
Switch parameter to force getting a new token from Microsoft Graph.-OnlyAssigned
If specified, only entities that actually have at least one custom security attribute assignment are returned. This is the default behavior; the switch is kept for explicit/discoverable usage.-UnusedOnly
Returns the attribute definitions that exist in the tenant but are assigned to no entity, instead of the assignments themselves. These are the cleanup candidates: a definition nobody uses still shows up in every attribute picker and still has to be governed. The scan is the same either way, so the count is always reported, whether or not this switch is present. The count is only trustworthy when every entity type was scanned without error. With a restricted -EntityType, or after an entity read failure, the result is reported as scoped: an attribute assigned only on a skipped entity type would otherwise look unused. A failure to read the definitions themselves is different: there is nothing to compare the assignments against, so the unused report is unavailable rather than scoped.CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.INPUTS
OUTPUTS
System.Management.Automation.PSObject
Not documented.NOTES
Required Microsoft Graph permissions:- CustomSecAttributeDefinition.Read.All
- CustomSecAttributeAssignment.Read.All
- User.Read.All
- Device.Read.All
- Application.Read.All