List Azure role-based access control (RBAC) role assignments at a subscription, resource group, or scope.
The scope defaults to the active subscription and can be narrowed with -ResourceGroupName or overridden
with -Scope (the two are mutually exclusive). Use -ObjectId to filter to a single principal by its
object (principal) ID. Filtering by sign-in name, service-principal name, or role name is not yet supported.
By default only assignments made at the exact scope are listed. Use -IncludeInherited to also include
assignments inherited from ancestor scopes. (This widening switch is deliberately named -IncludeInherited
rather than classic's -AtScope, whose name signals the opposite — restricting to a scope — to avoid
surprising scripts migrated from classic.) Use -ExpandPrincipalGroups together with -ObjectId to also
include assignments the principal receives transitively through the groups it belongs to (it requires
an assignee). Use -IncludeNestedScopes to list assignments across the whole subscription including
every nested scope (resource groups and resources); it cannot be combined with -Scope,
-ResourceGroupName, or -IncludeInherited.
Examples
List role assignments in the subscription
List every role assignment in the active (or specified) subscription.
List across the whole subscription including nested scopes
-IncludeNestedScopes lists assignments on the subscription and every resource group and resource beneath it. It cannot be combined with -Scope or -ResourceGroupName.
Get-AzRoleAssignment -IncludeNestedScopes
Parameters
-ExpandPrincipalGroups
When filtering by -ObjectId, also include assignments granted through groups the principal belongs to (transitive).
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.
One RoleAssignment object per matching assignment, including its id, name, and properties (role definition id, principal id and type, and scope).
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.