Skip to content
WETNav

Investigation · Cloud

What did the attacker do in our Azure subscriptions?

Scope an Azure control-plane intrusion from the Activity Log: role assignments, VM run command and extensions, key and secret access, log and network changes.

When you would ask thisAn identity with Azure RBAC rights (a user, a service principal or a managed identity) is compromised, or Defender for Cloud has flagged suspicious management activity. You need to know what the attacker changed, ran or read across your subscriptions, and what to roll back.

Steps

  1. 1

    Find who reached Azure Resource Manager

    Every management action goes through Azure Resource Manager (ARM), so the Entra sign-in to it is the starting point. In sign-in logs ARM appears as the resource Windows Azure Service Management API (app ID 797f4846-ba00-4fd7-ba43-dac1f8f63013); confirm the display name in your tenant and filter on the resource ID where that column exists. Note which client was used (Azure portal, Azure CLI, Azure PowerShell or a custom app), the IP and ASN, and whether the identity is a user, a service principal (AADServicePrincipalSignInLogs) or a managed identity (AADManagedIdentitySignInLogs). Service principal and managed identity sign-ins reach your workspace only if those categories were exported; otherwise use the Entra admin center within its retention.

    Sign-ins to Azure Resource Manager by identity type (Sentinel KQL)
    union isfuzzy=true
        (SigninLogs | extend Kind = "user interactive"),
        (AADNonInteractiveUserSignInLogs | extend Kind = "user non-interactive"),
        (AADServicePrincipalSignInLogs | extend Kind = "service principal"),
        (AADManagedIdentitySignInLogs | extend Kind = "managed identity")
    | where TimeGenerated > ago(30d)
    | where ResourceDisplayName =~ "Windows Azure Service Management API"
        or column_ifexists("ResourceIdentity", "") == "797f4846-ba00-4fd7-ba43-dac1f8f63013"
    | extend Identity = coalesce(UserPrincipalName, column_ifexists("ServicePrincipalName", ""))
    | summarize FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated),
        IPs = make_set(IPAddress, 20), Clients = make_set(AppDisplayName, 10)
        by Kind, Identity
    | order by FirstSeen asc
  2. 2

    Pull the attacker's Activity Log entries

    The Azure Activity Log records control-plane writes, deletes and actions (not reads) for each subscription. In Sentinel or Log Analytics it is the AzureActivity table: Caller is the UPN for users and an object or application ID for service principals and managed identities, CallerIpAddress is the source, OperationNameValue is the operation (for example Microsoft.Authorization/roleAssignments/write), ActivityStatusValue shows the stage and result (Start, Success, Failure and similar; values and casing vary between connector versions), and ResourceId names the target. The portal and CLI keep 90 days; anything older exists only if a diagnostic setting exported it. Pull everything for the compromised identity and the attacker IPs, and group by CorrelationId so each operation's start and result sit together.

    Everything one caller did in a subscription (Azure CLI)
    az monitor activity-log list \
      --start-time 2026-10-01T00:00:00Z --end-time 2026-10-31T23:59:59Z \
      --caller [email protected] --max-events 1000 \
      --query "[].{time:eventTimestamp, op:operationName.value, status:status.value, ip:httpRequest.clientIpAddress, resource:resourceId, correlation:correlationId}" \
      -o table
    
    # Run per subscription (az account set --subscription <id>). Caller is the UPN for users
    # and an object or application ID for service principals and managed identities.
  3. 3

    Hunt the high-impact operations

    Filter the attacker's activity, then the whole tenant for the incident window, for the operations that matter most: roleAssignments/write and roleDefinitions/write (privilege); virtualMachines/runCommand/action, virtualMachines/runCommands/write and virtualMachines/extensions/write (code execution on VMs); vaults/accessPolicies/write and vaults/write on Key Vault (granting secret access); storageAccounts/listKeys/action (taking storage account keys); diagnosticSettings/delete or write (cutting off logs); networkSecurityGroups/securityRules/write (opening network paths); and disks/beginGetAccess/action (issuing a download URL for a VM disk). Each is a control-plane record that the change or action happened; what was done with it usually needs a second source.

    High-impact control-plane operations, grouped per operation (Sentinel KQL)
    let highImpact = dynamic([
        "microsoft.authorization/roleassignments/write",
        "microsoft.authorization/roledefinitions/write",
        "microsoft.compute/virtualmachines/runcommand/action",
        "microsoft.compute/virtualmachines/runcommands/write",
        "microsoft.compute/virtualmachines/extensions/write",
        "microsoft.keyvault/vaults/accesspolicies/write",
        "microsoft.keyvault/vaults/write",
        "microsoft.storage/storageaccounts/listkeys/action",
        "microsoft.insights/diagnosticsettings/delete",
        "microsoft.insights/diagnosticsettings/write",
        "microsoft.network/networksecuritygroups/securityrules/write",
        "microsoft.compute/disks/begingetaccess/action"]);
    AzureActivity
    | where TimeGenerated > ago(90d)
    | where tolower(OperationNameValue) in (highImpact)
    | summarize FirstSeen = min(TimeGenerated), Statuses = make_set(ActivityStatusValue, 5)
        by CorrelationId, OperationNameValue, Caller, CallerIpAddress, _ResourceId
    | order by FirstSeen asc
  4. 4

    Read the privilege changes

    For roleAssignments/write, the role and the principal are in the request body captured in Properties_d (often under requestbody; confirm how your workspace stores it). Check the RoleDefinitionId against the built-in roles that give control: Owner (8e3af657-a8ff-443c-a75c-2fe8c4bcb635), Contributor (b24988ac-6180-42a0-ab88-20f7382dd24c) and User Access Administrator (18d7d88d-d35e-4fb5-a5c3-7773c20a72d9), and note the scope (management group, subscription or resource group). A Global Administrator can also elevate to User Access Administrator at root scope (Microsoft.Authorization/elevateAccess/action); that is a tenant-level event that does not appear in any subscription's Activity Log, so check the directory-level activity log and the Entra audit log for it, and confirm where your tenant records it. Also check Entra for credentials added to service principals the attacker used, since a new secret on an app with Owner is durable access.

    Role assignment writes with role and principal (Sentinel KQL)
    AzureActivity
    | where TimeGenerated > ago(90d)
    | where OperationNameValue =~ "Microsoft.Authorization/roleAssignments/write"
    // requestbody is usually on the Start record, and property casing can differ:
    // inspect one Properties_d value before relying on these paths.
    | extend Body = parse_json(tostring(Properties_d.requestbody))
    | extend RoleDefinitionId = tostring(Body.Properties.RoleDefinitionId),
        PrincipalId = tostring(Body.Properties.PrincipalId),
        PrincipalType = tostring(Body.Properties.PrincipalType)
    | project TimeGenerated, Caller, CallerIpAddress, ActivityStatusValue, RoleDefinitionId,
        PrincipalId, PrincipalType, _ResourceId, CorrelationId
    | order by TimeGenerated asc
  5. 5

    Follow execution onto VMs

    Run command and VM extensions let anyone with the right role run code as SYSTEM on Windows or root on Linux without signing in to the VM. The Activity Log shows that runCommand/action or an extension write happened, on which VM and by whom, but not the script content. Get that from the VM: the Run Command and Custom Script extensions download scripts and write logs under C:\Packages\Plugins\ and C:\WindowsAzure\Logs\Plugins\ on Windows, and under /var/lib/waagent/ and /var/log/azure/ on Linux (exact subfolders vary by extension and version). An unexpected VMAccess extension can mean a local password or SSH key was reset. From there, investigate the VM as a host compromise.

  6. 6

    Scope secrets and data the attacker reached

    Control-plane records show access being granted or keys being taken; data-plane logs show what was read. After a Key Vault access policy or role change, check the vault's diagnostic logs (the AuditEvent category, in AzureDiagnostics or the resource-specific AZKVAuditLogs table depending on configuration) for SecretGet, KeyGet and CertificateGet by the attacker's identity or IP. After listKeys on a storage account, the key holder can read data with no further Entra sign-in, so check storage data-plane logs (StorageBlobLogs and the related tables) for access from attacker IPs, and treat the account's data as exposed if those logs were not enabled. A disk beginGetAccess by the attacker means a download URL for the whole disk was issued; treat its contents, including any credentials on it, as exposed unless you can show it was not used.

  7. 7

    Contain and roll back

    Remove the attacker's role assignments and custom roles, reset or remove credentials on service principals they used or created, and revoke user sessions. Rotate storage account keys that were listed and every Key Vault secret the attacker could read, then fix the applications that depend on them. Restore deleted diagnostic settings and revert NSG rules. Check for persistence beyond RBAC: new VMs, automation accounts and runbooks, Logic Apps, managed identities with role assignments, and federated credentials on app registrations. Compare current role assignments in every subscription with your baseline rather than trusting the Activity Log alone, since anything older than its retention will not appear there.

    Review and remove role assignments, rotate a listed key (Azure CLI)
    # Current role assignments for the suspect principal (run per subscription)
    az role assignment list --assignee <principal-object-id> --all --include-inherited -o table
    
    # Remove a malicious assignment
    az role assignment delete --ids <role-assignment-resource-id>
    
    # Rotate a storage account key the attacker listed
    az storage account keys renew --resource-group <rg> --account-name <account> --key primary

Where it goes wrong

  • The Activity Log records writes, deletes and actions, not reads, so resource enumeration through GET requests is invisible there; a quiet log before the first write does not mean the attacker was not looking around.
  • Portal and CLI access to the Activity Log covers 90 days; older activity exists only if a diagnostic setting sent it to Log Analytics, a storage account or an event hub.
  • listKeys, Key Vault policy changes and run command show that access was taken or code ran, not what was read or executed; data-plane logs and on-VM artifacts must have been enabled or collected to answer that.
  • Caller is a GUID for service principals and managed identities; resolve it in Entra before deciding whether activity was automation or the attacker.
  • Global Administrator elevation to User Access Administrator is recorded at tenant level, not in subscription Activity Logs, so a subscription-only review can miss how the attacker got RBAC rights.
  • Deleting a diagnostic setting creates a gap in exported logs from that moment, but the platform Activity Log still holds 90 days, so pull it directly to fill the gap.

Beyond event logs

On-VM extension and run command artifacts

Windows: C:\Packages\Plugins\ and C:\WindowsAzure\Logs\Plugins\; Linux: /var/lib/waagent/ and /var/log/azure/

Hold the scripts and output of Run Command and Custom Script extension executions, which the Activity Log does not record.

Key Vault and storage data-plane logs

Diagnostic settings on each vault and storage account (AzureDiagnostics, AZKVAuditLogs, StorageBlobLogs)

Show secret reads and blob access by identity or key and IP; without them, exposure after a policy change or listKeys cannot be bounded.

Defender for Cloud alerts

Microsoft Defender for Cloud security alerts for the affected subscriptions

Plans such as Defender for Resource Manager, Key Vault and Storage alert on suspicious management and data-plane activity, and can cover gaps where logs were not exported.

References