How the attack works
A custom Azure role definition lists the actions and data actions it allows and the scopes where it can be assigned. Editing a definition changes the effective permissions of every principal that holds the role, at once, without creating a role assignment, so monitoring that only watches assignments of Owner or Contributor does not notice it.
Attackers who hold Microsoft.Authorization/roleDefinitions/write on the role's assignable scopes add actions such as Microsoft.Authorization/roleAssignments/write, VM Run Command, Key Vault or managed identity operations to a custom role that an account they control already holds, or create a new role that looks harmless by name. Every create or update is recorded in the Azure Activity log as Microsoft.Authorization/roleDefinitions/write.
What an attacker needs
Microsoft.Authorization/roleDefinitions/writeon all assignable scopes of the role (Owner, User Access Administrator, or a custom role that includes the action).
Impact
Privilege escalation for every holder of the role, up to Owner-equivalent rights, hidden inside an assignment that was approved when the role was harmless.
Detection rules
Azure Custom Role Definition Created or Updated
Detects a successful create or update of an Azure custom role definition. Changing a definition changes the permissions of every principal that holds the role, without a new role assignment.
title: Azure Custom Role Definition Created or Updated
id: 1edb2cdb-1112-4747-a2be-c1b43c6894f4
status: experimental
description: >-
Detects a successful create or update of an Azure custom role definition.
Changing a definition changes the permissions of every principal that holds
the role, without a new role assignment.
references:
- https://attack.mitre.org/techniques/T1098/003/
- https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles
- https://learn.microsoft.com/en-us/azure/role-based-access-control/change-history-report
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/management-and-governance
author: Forestall
date: 2026-11-10
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue: MICROSOFT.AUTHORIZATION/ROLEDEFINITIONS/WRITE
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Planned custom role maintenance by the platform team or an infrastructure-as-code pipeline; correlate with change records and exclude the pipeline identity in a filter_ selection by Caller.
level: medium
False positives
- Planned custom role maintenance by the platform team or an infrastructure-as-code pipeline; correlate with change records and exclude the pipeline identity in a filter_ selection by Caller.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Custom role created or changed and assigned by the same caller shortly after
An identity that can write both role definitions and role assignments builds the role it needs and then assigns it, often to a principal it controls. A role definition write followed within hours by an assignment of that same role by the same caller is a privilege grant split into two steps that each look routine.
- In the Azure Activity log, take a successful
MICROSOFT.AUTHORIZATION/ROLEDEFINITIONS/WRITE. Keep theCaller, the time and the role definition ID at the end of the resource ID. - Within 24 hours, take the start events of
MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITEby the sameCallerwhose request body inPropertiescarries that ID inRoleDefinitionId. Confirm the Success event with the same correlation ID. - Read
PrincipalId,PrincipalTypeandScopefrom the request body. Review first the assignments to users from outside the organization, to service principals and to the caller itself.
EventsMICROSOFT.AUTHORIZATION/ROLEDEFINITIONS/WRITEMICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE
LimitsInfrastructure-as-code deploys a custom role and its assignments in one run, so the deployment identities have to be excluded by name. An attacker who leaves more time between the steps, or uses two identities, does not match. The 24 hours are a starting point.
Custom role changed by a principal that holds the role itself
Editing a role that one already holds raises one's own rights without any new role assignment, which is the quietest form of this attack. A role definition write whose caller is among the assignees of that same role is self-escalation and deserves review every time it happens.
- In the Azure Activity log, take a successful
MICROSOFT.AUTHORIZATION/ROLEDEFINITIONS/WRITE. Keep the role definition ID from the resource ID, and the caller's object ID from the object identifier claim (http://schemas.microsoft.com/identity/claims/objectidentifier) inClaims. - List the assignments of that role, from a current export of role assignments or from earlier
MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITErequest bodies with thatRoleDefinitionId. - Report the writes where the caller's object ID is the
PrincipalIdof an assignment of the role, or of a group the caller belongs to.
EventsMICROSOFT.AUTHORIZATION/ROLEDEFINITIONS/WRITEMICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE
LimitsA platform team that maintains a custom role it also holds matches every time and has to be excluded by name. Assignments older than the Activity log retention, and group memberships, need a current export. The match shows that the caller changed its own role, not which actions were added.
Triage
- Identify the Caller and the role from the event, and compare the current definition with its previous version (infrastructure-as-code history or an earlier export).
- List who holds the role and at which scopes, and review their activity since the change.
- Revert unexplained permission changes and review what holders did while the role was widened.
Response
Once the attack is confirmed:
- If the approved version of the definition is not at hand, remove the role's assignments from the suspect principals first, so the widened permissions stop applying. Restoring the definition can follow once the baseline is found.
- Take
Microsoft.Authorization/roleDefinitions/writeaway from the caller by removing its Owner, User Access Administrator or custom role, then revoke its sessions and rotate its credentials. - Undo what the holders did with the added actions. If role assignment rights were added, list and remove the assignments they created. If Key Vault, Run Command or managed identity actions were added, rotate the secrets and review the machines and identities they reached.
- Look for other custom roles created or changed by the same caller, including new roles with harmless names that are not assigned yet.
- After cleanup, confirm the effective permissions of each holder at every scope where the role is assigned.
Mitigation
- Restrict who can write role definitions and manage custom roles through reviewed infrastructure-as-code changes.
- Avoid wildcard actions and broad assignable scopes in custom roles; review custom roles that include role assignment, Run Command, Key Vault or managed identity actions.
- Compare custom role definitions against an approved baseline and alert on every change.
Frequently asked questions
Why does monitoring of privileged role assignments not notice this change?
Editing a custom role definition changes the effective permissions of every principal that holds the role, at once, and creates no role assignment. Monitoring that watches only assignments of Owner or Contributor sees nothing. The change is recorded in the Azure Activity log as a write to the role definition.
Can the rule tell a harmless edit from one that adds powerful actions?
No. The rule matches every successful create or update of a custom role definition, whatever the content of the change. Compare the current definition with its previous version, and look for role assignment, Run Command, Key Vault or managed identity actions among the additions.
A new custom role was created but not assigned to anyone. Does it matter yet?
A role definition grants nothing until it is assigned to a principal at a scope. It still deserves a look, because attackers create roles that look harmless by name and assign them later. Read its actions and assignable scopes, and watch for the first assignment of the role.