Skip to content

Instantly share code, notes, and snippets.

@JosiahSiegel
Created December 16, 2025 14:36
Show Gist options
  • Select an option

  • Save JosiahSiegel/46c5b31b130846808401a2f7103f13cf to your computer and use it in GitHub Desktop.

Select an option

Save JosiahSiegel/46c5b31b130846808401a2f7103f13cf to your computer and use it in GitHub Desktop.
Get User's Azure Resource Group RBAC Assignments
az role assignment list --assignee <USER_OBJECT_ID> --all --include-inherited --include-groups -o json | jq -r '["| Resource Group | Roles |", "|----------------|-------|"] + ([.[] | select(.scope | test("/resourceGroups/[^/]+$") or test("/subscriptions/[^/]+$") or test("/managementGroups/")) | {rg: (.resourceGroup // "Subscription-level"), role: .roleDefinitionName}] | group_by(.rg) | map({rg: .[0].rg, roles: (map(.role) | unique | sort | join(", "))}) | sort_by(.rg) | map("| \(.rg) | \(.roles) |")) | .[]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment