Created
January 30, 2026 00:08
-
-
Save RylandDeGregory/d2391915c22583af326abafb35c65ff4 to your computer and use it in GitHub Desktop.
Get all Azure RBAC Roles in an Entra Tenant for a given ObjectId.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ObjectId = '' | |
| $TenantId = '' | |
| Connect-AzAccount -Tenant $TenantId | |
| # Process all Subscriptions the logged in user has access to | |
| Get-AzSubscription -TenantId $TenantId | ForEach-Object { | |
| Write-Verbose "Processing Azure Subscription [$($_.Id) ($($_.Name))]..." -Verbose | |
| Set-AzContext $_.Id -Tenant $TenantId | Out-Null | |
| Get-AzRoleAssignment -ObjectId $ObjectId | |
| } | Select-Object DisplayName, RoleDefinitionName, Scope | Format-Table -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment