/secskills-defense:investigating-azure-incidentsfrom secskills-defense
Reconstructs Azure security incidents from Activity Log and diagnostic logs, tracking attacker identity, privilege escalation, and data exfiltration. Use for resource compromise, crypto-mining, or Defender alerts.
Ships in secskills-defense. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
In Azure the control plane logs almost everything through Azure Resource Manager, so an incident is reconstructed from the Activity Log and the resource/data-plane logs, anchored on the identity that made the calls -- a user, a service principal, or a managed identity. The recurring trap is that identity lives in Entra while the damage lives in the subscription: you must correlate across both planes, because the Activity Log tells you what was done to a resource but the Entra sign-in log tells you who held the token and from where.
AccessDenied storm that looks like enumerationinvestigating-m365-entrainvestigating-aws-incidentsinvestigating-gcp-incidentsattacking-entra-idattacking-eks-gke-aks; for defending the cluster, defending-kubernetesresponding-to-incidentsEstablish what you have before you query. Missing logs are a finding, not a reason to skip the question.
| Source | Scope | Retention (default) | What it holds |
|---|---|---|---|
| Azure Activity Log | Subscription control plane | 90 days unless exported | Every ARM write/action/delete: roleAssignments, runCommand, listKeys, deployments |
| Resource / diagnostic logs | Per-resource data plane | None until enabled | Blob reads, Key Vault SecretGet, NSG flow -- only if a diagnostic setting ships them to a workspace |
| Log Analytics workspace | Wherever logs are shipped | Workspace-configured | AzureActivity, AzureDiagnostics, StorageBlobLogs, AZKVAuditLogs tables |
| Entra sign-in / audit logs | Tenant identity plane | 30 days (export for more) | Who authenticated the SP/MI, from where, CA/MFA context, credential adds |
| Microsoft Sentinel | Whatever it ingests | Per-table | Correlated hunting across all of the above, incidents, watchlists |
The trap: the Activity Log is a control-plane record. Data-plane operations -- reading a blob, fetching a Key Vault secret, querying a Cosmos DB -- are not in the Activity Log at all. They exist only if a diagnostic setting was configured on that resource before the incident. Absence in the Activity Log is never evidence that data was untouched (see Rationalizations).
Confirm what is actually being logged before you trust a gap: az monitor diagnostic-settings subscription list (is the Activity Log exported beyond 90
days?) and az monitor diagnostic-settings list --resource <id> (does this
storage account / vault ship data-plane logs anywhere?).
Three moves, in order: scope the caller identity, pull its recent activity, preserve before you contain.
Scope the caller identity. Resolve the report -- a Defender alert, a
billing spike, a suspicious deployment -- to the identity in the caller /
identity fields of the Activity Log. That principal (a UPN, or a service
principal / managed identity object ID) is the anchor for everything else.
# Everything a specific caller did across the subscription control plane
az monitor activity-log list --caller [email protected] \
--start-time 2026-07-01T00:00:00Z -o json
# Who holds what right now -- role assignments are the escalation surface
az role assignment list --all --include-inherited \
--query "[?roleDefinitionName=='Owner' || roleDefinitionName=='User Access Administrator']" -o table
Pull recent activity from KQL if a Log Analytics workspace exists -- it is faster and richer than the CLI once you are past the first look:
AzureActivity
| where TimeGenerated > ago(7d)
| where Caller == "[email protected]"
| project TimeGenerated, OperationNameValue, ActivityStatusValue,
CallerIpAddress, ResourceProviderValue, ResourceId, CorrelationId
| order by TimeGenerated asc
Preserve, then contain. An attacker who sees a role assignment revoked mid-operation will burn persistence you have not found. For anything but active, ongoing damage: snapshot disks, export the relevant logs, map persistence, then contain everything at once. Live mining or active exfil is the exception -- stop the damage and accept the trade.
The AzureActivity table is the authoritative control-plane record. Learn its
fields:
OperationNameValue -- the ARM operation, e.g.
Microsoft.Authorization/roleAssignments/write. This is what you hunt on.Caller -- the UPN or object ID that made the call.CallerIpAddress -- external IPs on a managed identity that should only
call from inside Azure are the IMDS-theft signature (below).ResourceProviderValue -- Microsoft.Compute, Microsoft.Storage,
Microsoft.KeyVault, Microsoft.Authorization.ActivityStatusValue -- a run of Failure (often AuthorizationFailed)
is enumeration: the attacker mapping what the stolen principal can reach.CorrelationId -- ties the sub-operations of one logical action together;
pivot on it to expand a single suspicious event into its full sequence.// Enumeration storm -- authorization failures by operation
AzureActivity
| where TimeGenerated > ago(7d)
| where ActivityStatusValue == "Failure"
| summarize n = count() by Caller, OperationNameValue, CallerIpAddress
| order by n desc
// Expand one event's full correlated sequence
AzureActivity
| where CorrelationId == "<correlation-id>"
| project TimeGenerated, OperationNameValue, ActivityStatusValue, ResourceId
| order by TimeGenerated asc
Grep the timeline for these OperationNameValue patterns -- they are the shape
of nearly every Azure intrusion.
Microsoft.Authorization/roleAssignments/write granting Owner,
Contributor, or User Access Administrator (UAA can grant itself
anything). Watch for custom-role creation
(Microsoft.Authorization/roleDefinitions/write) that hides * actions
behind an innocuous name.Caller from an unexpected CallerIpAddress.Microsoft.Compute/virtualMachines/runCommand/action and Custom Script
Extension (Microsoft.Compute/virtualMachines/extensions/write installing
CustomScript) run attacker code as SYSTEM/root without any RDP/SSH.Microsoft.Web/sites (App Service /
Functions), Automation Runbooks, and Logic Apps as scheduled backdoors
that re-mint credentials or re-grant roles.AzureActivity
| where TimeGenerated > ago(14d)
| where OperationNameValue has_any (
"roleAssignments/write", "roleDefinitions/write",
"runCommand/action", "virtualMachines/extensions/write")
| project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, ResourceId
| order by TimeGenerated asc
The CLI equivalent filters the same operations:
az monitor activity-log list --start-time <t> --query "[?contains(operationName.value,'roleAssignments/write')]".
The Activity Log names the principal but not the human behind it. Map the
service principal or managed identity object ID back to Entra to see the
authentication context -- this is the cross-plane step, and it usually means
opening investigating-m365-entra.
// Where did this service principal / managed identity actually sign in from?
AADServicePrincipalSignInLogs
| where ServicePrincipalId == "<sp-or-mi-object-id>"
| where TimeGenerated > ago(30d)
| project TimeGenerated, AppId, ServicePrincipalName, IPAddress,
ResourceDisplayName, ResultType
| order by TimeGenerated asc
// For an interactive user: sign-ins around the abusive Activity Log calls
SigninLogs
| where UserPrincipalName == "[email protected]"
| project TimeGenerated, IPAddress, Location, AppDisplayName,
ConditionalAccessStatus, AuthenticationRequirement, ResultType
Check conditional-access status and whether MFA was actually satisfied -- a service principal bypasses interactive CA entirely, which is exactly why attackers pivot to SP/MI credentials.
The Azure analogue of AWS IMDS theft: an SSRF or foothold on a VM / App Service reads the Instance Metadata Service to lift the managed identity's token, then uses it elsewhere.
http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/
The signature is unmistakable: the managed identity's calls appear in
AzureActivity from a CallerIpAddress that is not the resource's own
outbound IP. The token is minted for that resource, so any call from an
unrelated or external IP means the token left the box.
AzureActivity
| where TimeGenerated > ago(7d)
| where Caller == "<managed-identity-object-id>"
| summarize ops = count() by CallerIpAddress, OperationNameValue
| order by ops desc // flag IPs that are not the VM's egress
Correlate the theft window with NSG flow logs (if enabled) for the outbound
SSRF and the reuse source. On App Service the token endpoint uses
IDENTITY_ENDPOINT with a header secret rather than 169.254.169.254 -- the same
off-resource-use logic applies.
Defender for Cloud is a starting pistol, not the investigation. Each alert maps to a hypothesis you confirm in the Activity Log and diagnostic logs.
| Alert (representative) | Implication |
|---|---|
Crypto-mining / Digital currency mining behavior | A VM is talking to a mining pool -- a principal with deploy rights was compromised. |
Anomalous resource deployment / unusual RunInstances-equivalent | Attacker spinning up compute, often in an unused region. |
| Suspicious sign-in / access from a Tor or known-malicious IP | The stolen principal called from attacker infrastructure. |
| Managed identity / metadata credential exfiltration | The IMDS theft above -- confirm off-resource token use. |
| Access from anomalous location on a storage account / Key Vault | Data-plane access from an unexpected geography. |
az security alert list -o table
az security alert show --location <loc> -n <alert-name> -g <rg>
An alert older than the 90-day Activity Log window still carries the principal and IPs -- pivot on those even after the raw events have aged out.
Microsoft.Storage/storageAccounts/listKeys/action and regenerateKey
hand the attacker a full-access key that works outside RBAC and outside the
Activity Log thereafter.listAccountSas / listServiceSas produces a
time-boxed exfil URL that leaves no per-object control-plane trail.StorageBlobLogs shows GetBlob volume by caller.Microsoft.Compute/snapshots/write then /beginGetAccess/action mints a SAS
download URL for a full disk image.Microsoft.KeyVault/vaults/read (VaultGet)
to enumerate, then data-plane SecretGet reads (in AzureDiagnostics /
AZKVAuditLogs, only if logging was enabled).// Control-plane data-theft indicators
AzureActivity
| where TimeGenerated > ago(14d)
| where OperationNameValue has_any (
"storageAccounts/listKeys", "storageAccounts/regenerateKey",
"listAccountSas", "listServiceSas",
"snapshots/write", "snapshots/beginGetAccess")
| project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, ResourceId
// Key Vault data-plane reads -- only present if diagnostics were on beforehand
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.KEYVAULT"
| where OperationName in ("SecretGet", "KeyGet", "VaultGet")
| project TimeGenerated, CallerIPAddress, identity_claim_upn_s, OperationName, id_s
A capable attacker tries to blind you. The key operations to hunt -- and their defeat:
Microsoft.Insights/diagnosticSettings/delete stops data-plane logs from
reaching the workspace.The defeat is the same shape as an AWS org trail: a tenant-level export to a
central, locked destination the compromised principal cannot reach --
immutable-storage (WORM/legal-hold) blob export, or Sentinel ingestion in a
segregated workspace with delete protection and resource locks. When export is
immutable, the attacker's own diagnosticSettings/delete call is logged there
before it takes effect, so cleanup becomes evidence rather than a gap. If you
lack it, record the blind window as a scoping limitation.
AzureActivity
| where TimeGenerated > ago(14d)
| where OperationNameValue has_any (
"diagnosticSettings/delete", "Microsoft.Insights/diagnosticSettings/write")
| project TimeGenerated, Caller, CallerIpAddress, OperationNameValue, ResourceId
Snapshot the involved VMs' disks before touching them, and lock the snapshots so they cannot be deleted.
az snapshot create -g <rg> -n IR-2026-042-osdisk \
--source <os-disk-id> --tags case=IR-2026-042 legal-hold=true
az lock create --name IR-2026-042-hold --lock-type CanNotDelete \
--resource-group <rg> --resource-name IR-2026-042-osdisk \
--resource-type Microsoft.Compute/snapshots
Export the relevant Activity Log window before it ages out of 90-day retention -- run the CLI/KQL and save the JSON to a preserved, locked store.
Apply resource locks / legal hold to evidence artifacts, and involve legal before collection if the incident may become a regulatory or litigation matter.
Do it all at once, after scoping. Partial containment alerts the attacker.
Disable or rotate the compromised principal. For a service principal / app, disable it and roll its credentials:
az ad sp update --id <app-id> --set accountEnabled=false
# remove attacker-added secrets/certs
az ad app credential reset --id <app-id>
For a user, disable the account and force a reset in Entra, then revoke sessions (below).
Revoke role assignments the attacker granted:
az role assignment delete --assignee <object-id> \
--role Owner --scope /subscriptions/<sub-id>
Revoke sessions / refresh tokens so existing tokens die (an Entra action
-- Revoke-MgUserSignInSession / az ad user ...), because disabling alone
leaves issued tokens valid up to an hour.
Isolate the VM by swapping its NSG to a deny-all outbound rule rather than
deleting it, so disk and memory survive for analysis (az network nsg rule create ... --access Deny --direction Outbound --protocol '*').
Rotate storage keys and regenerate SAS -- renewing both keys invalidates every outstanding SAS and access key at once:
az storage account keys renew --account-name <acct> -g <rg> --key primary
az storage account keys renew --account-name <acct> -g <rg> --key secondary
Remove attacker persistence -- delete backdoor Functions/App Service, Automation runbooks, custom roles, and resource-scoped role assignments -- only after they are documented.
Reach for Azure CLI and KQL in Log Analytics / Sentinel for the investigation itself; MicroBurst and ROADtools for understanding the TTPs an attacker would run (and what each leaves behind); and Microsoft's Unified Audit correlation when the Azure story crosses into M365.
CallerIpAddress is precisely the signature to hunt.runCommand on VMs, read storage keys, and mint SAS tokens -- code execution
and data theft without ever touching role assignments. Trace what the role can
reach; do not assume.roleAssignments/write. Mining is the visible symptom, not
the scope.investigating-m365-entra -- the sibling identity-plane skill; open it to correlate the SP/MI back to Entra sign-ins and auditinvestigating-aws-incidents -- the sibling cloud-IR skill when the incident is in AWSattacking-entra-id -- the offensive side; how these tenant/subscription TTPs are executedattacking-eks-gke-aks -- when the pivot is specifically into AKS / Kubernetesresponding-to-incidents -- the general IR process, evidence handling, and host-level responsereporting-security-findings -- structuring the incident narrative and deliverableaz) -- drive the control plane and pull the Activity LogAzureActivity, AzureDiagnostics, and sign-in tablesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gztes/security-for-platforms --plugin trilwu-secskills-defense22 skills in this plugin
/analyzing-disk-imagesPerform dead-disk forensics on an acquired disk image using The Sleuth Kit, Plaso, and bulk_extractor — verify integrity and mount read-only, map partitions, recover deleted files, build a file-system and super-timeline, carve unallocated space, mine registry hives and OS artifacts, and detect anti-forensics. Use when handed a .E01/.dd/.raw/.vmdk/.vhdx disk image or forensic acquisition to examine, recovering deleted files, building a file-system timeline, or carving artifacts from unallocated space./analyzing-linux-persistenceSystematically identify and analyze persistence mechanisms on Linux systems during DFIR investigations -- sweep systemd units, cron jobs, shell initialization, SSH config, kernel modules, LD_PRELOAD, package manager hooks, udev rules, container entrypoints, and XDG autostart entries. Use when investigating a compromised Linux host, performing forensic analysis of a Linux disk image, looking for backdoors or unauthorized access mechanisms, or determining how an attacker maintained access./analyzing-malwareAnalyze suspected malware safely — containment, static triage, sandboxed detonation, unpacking, capability and C2 extraction, IOC production, and YARA rule authoring. Use when handed a suspicious file, hash, or sample, when triaging an alert artifact, or when producing detection content from a specimen.2 plugins ship this exact skill · first indexed Jul 31, 2026
Other plugins' skills for the same job