Microsoft
Azure Activity Log
Every control-plane write in an Azure subscription: role assignments, VM run commands, key listing, disk exports and logging changes, with caller and IP.
Why it matters
Once an attacker has an identity with Azure RBAC rights, the Activity Log is the record of what they changed and which data they reached through the management plane. It is the place to find role grants, Run Command, storage key listing and disk exports.
How long it lasts
- 90 days in the Azure portal and through the REST API or Azure CLI, per subscription.
- Keep longer by sending it to Log Analytics (the AzureActivity table), a storage account or an event hub with a diagnostic setting on each subscription.
- Reads are not recorded. Data-plane access (blob reads, Key Vault secret reads) is in each resource's own diagnostic logs, which are off unless configured.
Get the data
az monitor activity-log list --offset 30d --caller [email protected] \
--query "[].{time:eventTimestamp, op:operationName.value, status:status.value, ip:httpRequest.clientIpAddress, resource:resourceId}" -o tableFields that matter
The action, as Provider/resourceType/action. This is what you hunt on.
UPN for users; object or application ID for service principals and managed identities.
Source IP of the management call.
Started, Accepted, Succeeded or Failed. One operation writes several records with the same correlation ID.
The full resource path: subscription, resource group, provider and name.
Groups the records of one operation, and of one deployment.
The scope the caller was authorized at.
Operation detail, including the request body for many writes (role definition and principal for role assignments).
Token claims of the caller, including the app ID and authentication method.
Values to know
OperationNameValue
All values- Microsoft.Authorization/roleAssignments/writeRole assignment createdAn Azure RBAC role was granted to a user, group or service principal.High signal
- Microsoft.Authorization/roleAssignments/deleteRole assignment removedAn Azure RBAC role assignment was deleted.Depends on context
- Microsoft.Authorization/roleDefinitions/writeCustom role created or changedA custom RBAC role definition was written.Suspicious
- Microsoft.Compute/virtualMachines/runCommand/actionVM Run CommandA script was run inside a VM through the Azure agent.High signal
- Microsoft.Compute/virtualMachines/extensions/writeVM extension writtenA VM extension such as Custom Script was installed or updated.Suspicious
- Microsoft.Compute/disks/beginGetAccess/actionDisk export URL createdA SAS URL to download a managed disk was generated.High signal
- Microsoft.Compute/snapshots/beginGetAccess/actionSnapshot export URL createdA SAS URL to download a disk snapshot was generated.High signal
- Microsoft.Compute/snapshots/writeSnapshot createdA disk snapshot was created or updated.Depends on context
- Microsoft.Storage/storageAccounts/listKeys/actionStorage account keys listedThe account access keys were read.Suspicious
- Microsoft.Storage/storageAccounts/regenerateKey/actionStorage account key regeneratedAn account key was rotated.Depends on context
Traps
- A diagnostic setting is per subscription. Subscriptions created after logging was set up are often missing from the SIEM.
- Each operation writes Started and Succeeded (or Failed) records. Count operations by correlation ID, not rows.
- The Activity Log shows that keys were listed or a disk export URL was created, not what was done with them. Pull the storage account and disk access logs separately, if they were enabled.
- Tenant-level actions such as elevating a Global Administrator to User Access Administrator at root scope are recorded outside a normal subscription's log. Check the directory activity logs as well.