How it works
Azure role-based access control is managed with the same mechanism it protects. A role assignment is a resource of type Microsoft.Authorization/roleAssignments that binds a principal to a role definition at a scope. Creating one is an ordinary management operation, Microsoft.Authorization/roleAssignments/write, and Azure Resource Manager allows it to any principal whose own roles include that action at the target scope.
So an identity that holds roleAssignments/write anywhere can hand out any role at that scope and below, to anyone, including itself. That is the whole attack: one write turns "can manage access" into Owner, and a second write gives the same role to a spare identity that survives the cleanup of the first.
The scope decides the reach. Assignments are inherited downward from management group to subscription to resource group to resource:
- Resource or resource group scope. The attacker gains control of one workload: its data roles, its managed identities and its secrets.
- Subscription scope. Owner on a subscription controls every resource in it, including virtual machines that carry managed identities and vaults that hold secrets.
- Management group scope. One assignment reaches every subscription under the group. A subscription's own scope string does not show its management group parent, so these grants are easy to miss in a per-subscription review.
- Root scope (
/). Reached through the variant below.
Three variants are worth naming:
- Direct assignment. The identity already holds Owner, User Access Administrator or Role Based Access Control Administrator and assigns a privileged role to itself or to another principal.
- Role definition change. With
Microsoft.Authorization/roleDefinitions/write, the attacker edits a custom role that is already assigned. Every existing assignment of that role now grants the added actions, and no new assignment is written. - Global Administrator elevation. Microsoft Entra roles and Azure roles are separate systems, but a Global Administrator can call
elevateAccess, which assigns the caller User Access Administrator at root scope. The role lets the account assign access in any subscription or management group in the tenant. This turns control of the directory into control of every Azure resource, without any record in a subscription.
A role definition holds actions and notActions for management operations and dataActions and notDataActions for data operations. notActions only subtracts within the same definition, so a second role assigned to the same principal can grant what the first excludes. This is why Contributor is not a safe ceiling for an identity that also holds a small custom role with Microsoft.Authorization/*.
Prerequisites
- A credential for an identity in the tenant: a user, a service principal, or a managed identity token taken from a workload.
- One of:
- a role that includes
Microsoft.Authorization/roleAssignments/writeat the target scope or above it. A Privileged Identity Management eligibility counts only once it is activated; - a role that includes
Microsoft.Authorization/roleDefinitions/writeon a custom role that is already assigned to an identity the attacker controls; - the Global Administrator role in Microsoft Entra ID, for the elevation variant.
- a role that includes
- No deny assignment or role assignment condition that blocks the write. Role Based Access Control Administrator can be assigned with a condition that limits which roles and principal types the holder may assign.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
The steps below are for an authorized assessment or a lab.
1. Find where the identity can write role assignments
# What the current identity holds, including inherited and group assignments
az role assignment list --all --assignee alice@corp.example.com \
--include-inherited --include-groups --output table
# Custom roles that carry authorization permissions
az role definition list --custom-role-only true \
--query "[?contains(to_string(permissions), 'Microsoft.Authorization')].{name:roleName, scopes:assignableScopes}"
The Azure reconnaissance page covers the full enumeration.
2. Assign a privileged role
At subscription scope, to the attacker's own account:
az role assignment create --assignee "alice@corp.example.com" \
--role "Owner" \
--scope "/subscriptions/00000000-0000-0000-0000-000000000000"
At resource group or management group scope, only the scope string changes:
az role assignment create --assignee "alice@corp.example.com" \
--role "Contributor" \
--scope "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-prod"
az role assignment create --assignee "alice@corp.example.com" \
--role "Owner" \
--scope "/providers/Microsoft.Management/managementGroups/mg-corp"
For persistence, the grant goes to a second identity the attacker controls, usually a service principal or a user-assigned managed identity. Use the object ID of the service principal, not the application ID:
az role assignment create --assignee-object-id "00000000-0000-0000-0000-000000000000" \
--assignee-principal-type "ServicePrincipal" \
--role "User Access Administrator" \
--scope "/subscriptions/00000000-0000-0000-0000-000000000000"
3. Variant: widen a custom role that is already assigned
Export the role, add actions to its permissions block, and write it back:
az role definition list --name "App Operator" --query "[0]" > role.json
# edit role.json: add "Microsoft.Authorization/roleAssignments/write" to "actions"
az role definition update --role-definition @role.json
Every principal that already holds the role gets the new actions. No roleAssignments/write event is produced.
4. Variant: Global Administrator elevates to root scope
Signed in as a Global Administrator:
# Assigns the caller User Access Administrator at root scope (/)
az rest --method post \
--url "/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"
# Confirm the assignment
az role assignment list --role "User Access Administrator" --scope "/"
# Then take what is needed, for example Owner on a subscription
az role assignment create --assignee "alice@corp.example.com" \
--role "Owner" \
--scope "/subscriptions/00000000-0000-0000-0000-000000000000"
A new sign-in is needed before the root assignment takes effect in the session. The setting is per user: it elevates the caller only, not every Global Administrator.
5. Remove the visible grant
An operator who wants to leave less behind removes the first assignment after planting the second:
az role assignment delete --assignee alice@corp.example.com \
--role "User Access Administrator" --scope "/"
Impact
Owner at subscription scope is full control of the cloud account: every resource, every data role the attacker chooses to assign next, every managed identity attached to a workload, and the ability to delete or lock out. At management group or root scope the same holds for many subscriptions at once. This is privilege escalation and persistence in one step, because the new assignment stays until someone removes it.
Typical next moves are assigning data-plane roles to read storage and Key Vault secrets, running code on virtual machines to take their managed identity tokens, and granting roles to a service principal that the attacker holds a credential for. An identity with roleAssignments/write that nobody thinks of as an administrator is a shadow admin.
OPSEC and artifacts
- Assigning to a second identity. Operators grant the role to a service principal or managed identity instead of their own account, so the beneficiary does not match the compromised user. The Activity Log record names the caller in
Caller; the beneficiary is theprincipalIdin the assignment's own properties, read from the assignment the record points to inResourceIdor from a saved snapshot. Both have to be reviewed. - Choosing a narrow scope or a quiet role. A resource group assignment of a less known role (Role Based Access Control Administrator, a custom role) draws less attention than Owner on a subscription. It writes the same
Microsoft.Authorization/roleAssignments/writerecord with the scope inAuthorization_d. - Editing a role instead of assigning one. The definition change avoids a new assignment. It leaves a
Microsoft.Authorization/roleDefinitions/writerecord and a new revision of the definition. - Assigning high in the hierarchy. A management group assignment does not appear in an export that is filtered to one subscription. It is recorded at the management group, so log collection has to cover that scope.
- Elevating and removing quickly. The root-scope assignment can be created and deleted within minutes. Both the elevation and the removal are written to the Microsoft Entra audit log and to the directory-level activity log, and the role assignments made in between remain in the subscriptions.
- Deleting the assignment afterwards. A
roleAssignments/deleterecord closes the interval but also marks it. The platform keeps Activity Log events for 90 days; a workspace keeps them for its own retention period. - Tokens outlive the grant. Removing an assignment does not invalidate access tokens already issued, so activity can continue briefly after cleanup.
Detection
- Privileged role assignments. Alert on successful
Microsoft.Authorization/roleAssignments/writefor Owner, User Access Administrator, Role Based Access Control Administrator and Contributor, and on any assignment at subscription scope or above. The privileged Azure role assignment rules implement this on the roleAssignments/write record. - Caller and beneficiary. Compare
Callerwith the assignment's principal. A caller assigning a role to itself, or to a service principal created recently, deserves review. - Role definition changes. The custom role definition rules cover roleDefinitions/write. Treat a definition change as a change of authority for every holder of the role.
- Elevate access. The Global Administrator elevate access rules read the Entra audit entry User has elevated their access to User Access Administrator for their Azure Resources. Follow every elevation to the first role assignment the same account makes.
- Assignments removed. Pair writes with roleAssignments/delete to rebuild the interval. Many removals at once is a different signal, covered by the role assignments removed in bulk rules.
// Role grant writes and removals, with the scope the caller acted on
AzureActivity
| where CategoryValue =~ "Administrative"
| where OperationNameValue in~ (
"Microsoft.Authorization/roleAssignments/write",
"Microsoft.Authorization/roleAssignments/delete",
"Microsoft.Authorization/roleDefinitions/write",
"Microsoft.Authorization/roleDefinitions/delete")
| where ActivityStatusValue in~ ("Success", "Succeeded")
| project TimeGenerated, OperationNameValue, ActivityStatusValue, Caller,
ResourceId, Authorization_d, CorrelationId
| order by TimeGenerated asc
The status value is spelled Success in some records and Succeeded in others, so accept both. A result limited to one subscription can't clear inherited grants: check the management groups above it, and remember that elevateAccess never appears in a subscription's log.
Mitigation
- Reduce who can write role assignments. Count the Owner, User Access Administrator and Role Based Access Control Administrator assignments at subscription scope and above, and remove what is not needed. Prefer Role Based Access Control Administrator with a condition that limits which roles can be assigned over a plain Owner assignment.
- Make the remaining ones eligible, not permanent. Use Privileged Identity Management for Azure resource roles with approval, a short activation time and MFA. The Entra PIM guide shows the setup.
- Keep workloads away from authorization permissions. A pipeline or automation identity rarely needs
Microsoft.Authorization/*. Review custom roles for it and for wildcards. - Remove elevated access. Microsoft recommends removing the root-scope User Access Administrator assignment as soon as the work is done. List assignments at scope
/regularly and delete any that remain. - Protect Global Administrator. Because one call converts it into control of every subscription, treat it as an Azure role too: few holders, phishing-resistant MFA, PIM activation.
- Collect the logs at every scope. Route the Activity Log of each subscription and management group, and the Microsoft Entra audit log, to a central workspace, so that management group grants and elevations are visible and kept longer than 90 days.
- Review assignments on a schedule. Compare the current list with the last reviewed one, and look for principals of type
ServicePrincipalwith privileged roles that no owner can explain.
Detection rules for this attack
Log events to collect
FAQ
Which Azure permissions let an identity grant itself more access?
Microsoft.Authorization/roleAssignments/write is the one that matters. Owner, User Access Administrator and Role Based Access Control Administrator carry it, and so can any custom role. Microsoft.Authorization/roleDefinitions/write is the indirect form: it changes what a role that is already assigned allows.
Can a Global Administrator access Azure subscriptions without a role assignment?
Not directly, but one call fixes that. A Global Administrator can call the elevateAccess operation, which assigns the caller User Access Administrator at root scope. From there the account can assign itself any role on any subscription or management group in the tenant.
Does the subscription Activity Log show an elevate access call?
No. The elevation acts above every subscription. It is recorded in the directory-level activity log and in the Microsoft Entra audit log under the service Azure RBAC (Elevated Access). A query limited to one subscription returns nothing for it, which is not proof that it did not happen.
Does removing the role assignment end the attacker's access?
It ends that grant. It does not invalidate tokens already issued, and it does nothing about a second identity the attacker granted a role to, a changed custom role, or a credential added to a service principal. Review every role assignment and definition write the same caller made.
References
- Account Manipulation: Additional Cloud Roles, T1098.003 (MITRE ATT&CK)
- Assign Azure roles using Azure CLI (Microsoft Learn)
- Elevate access to manage all Azure subscriptions and management groups (Microsoft Learn)
- Understand Azure role definitions (Microsoft Learn)
- AzureActivity table reference (Azure Monitor)
- az role definition (Azure CLI reference)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.