Skip to content

Instantly share code, notes, and snippets.

@RylandDeGregory
Created January 30, 2026 00:08
Show Gist options
  • Select an option

  • Save RylandDeGregory/d2391915c22583af326abafb35c65ff4 to your computer and use it in GitHub Desktop.

Select an option

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.
$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