Home/For responders/Incident response on Azure
Incident response on Azure
Azure keeps 90 days of changes to your resources without being asked. How far back you can see sign-ins, reads of your data, and calls to Microsoft Graph depends on licences and settings chosen before the incident.
What Azure records, and what it leaves out
| Log | On by default | Kept |
|---|---|---|
| Activity Log | Yes. Writes, deletes, and actions through Resource Manager. No reads | 90 days, unless a diagnostic setting sends it somewhere else |
| Resource logs | No. Reads of blobs, secrets, and other data appear only after you add a diagnostic setting to each resource | As long as the destination keeps them |
| Entra sign-in and audit logs | Yes | Seven days on the Free licence, 30 days with P1 or P2 |
| Microsoft Graph activity logs | No. Every request to Graph, reads included, once a diagnostic setting routes them. Needs P1 or P2 | As long as the destination keeps them |
The Entra logs are the short ones, and most Azure incidents begin there. Send them and the Activity Log to a workspace or storage account before you need them. The audit log template keeps the Activity Log where nobody in the subscription can delete it.
Reading an identity out of the logs
- The Activity Log names the caller.
callercontains a user's email or UPN, or a service principal's ID.claimscontains the token the call was made with. - Sign-ins come in four logs. Interactive user, non-interactive user, service principal, and managed identity. An attacker replaying a stolen refresh token appears in the non-interactive log.
- A managed identity sign-in names the resource that used it, such as the VM, and carries no IP address, because the request comes from inside Azure.
- New credentials on an app are audit events. Look for
Update applicationevents that change certificates and secrets, andAdd service principal credentials, in the Entra audit log. They are how an attacker keeps access after a user is disabled. - A pod using Workload ID signs in through a federated
credential. The sign-in carries
FederatedCredentialId; the credential's subject,system:serviceaccount:<namespace>:<name>, names the pod's service account.
az monitor activity-log list --caller <upn or app id> --offset 7d
az monitor activity-log list --resource-group <group> --offset 7d --query "[?authorization.action=='Microsoft.Authorization/roleAssignments/write']"
Containment, by what was compromised
The containment refresher puts the first move for each kind of compromise on one printable page.
| Compromised | First move | Watch out |
|---|---|---|
| A user | Disable the account, then Revoke-MgUserSignInSession, which invalidates refresh tokens and browser sessions | Access tokens already issued last about an hour. Services that support continuous access evaluation, such as Exchange Online, SharePoint, Teams, and Graph, drop them sooner |
| An app or service principal | Set the service principal's accountEnabled to false, then remove the credentials the attacker added | Other credentials on the same app, and permissions it was granted by consent |
| A managed identity | Remove its role assignments, and stop or isolate the resource that has it | Its tokens are cached for around 24 hours and cannot be refreshed early. Microsoft says role changes may take several hours to reach it |
| A VM | A CanNotDelete lock, snapshots of every disk, then a deny-all network security group. The evidence template does all three when someone tags the VM | Removing a rule that allowed a connection leaves existing connections running. A ReadOnly lock would also stop the VM being started or restarted |
| A device with Defender for Endpoint | Isolate the device. It keeps its connection to Defender, so you can still collect an investigation package | Isolation is part of Defender for Endpoint Plan 1 and above; a VM without the agent needs the network security group instead |
Saved queries
30 saved queries from four templates open in this cloud's console, named as the console lists them. The Standard and Hardened levels install them; the Quick start installs none. They are written in KQL, the Kusto Query Language that Log Analytics reads.
| Saved query | What it answers | Template that installs it | Where to open it |
|---|---|---|---|
ai-keys-fetched | The search behind the keys-fetched alert, over the last seven days. | Know who is using your AI models | Log Analytics workspace, Logs, Queries, category AI model logging |
ai-filters-changed | The search behind the filters-changed alert, over the last seven days. | Know who is using your AI models | Log Analytics workspace, Logs, Queries, category AI model logging |
ai-deployment-changed | The search behind the deployment-changed alert, over the last seven days. | Know who is using your AI models | Log Analytics workspace, Logs, Queries, category AI model logging |
ai-account-changed | The search behind the account-changed alert, over the last seven days. | Know who is using your AI models | Log Analytics workspace, Logs, Queries, category AI model logging |
ai-logging-weakened | The search behind the logging-weakened alert, over the last seven days. | Know who is using your AI models | Log Analytics workspace, Logs, Queries, category AI model logging |
ai-calls-by-caller | Inference calls in the last seven days, by account, caller object ID, and deployment. | Know who is using your AI models | Log Analytics workspace, Logs, Queries, category AI model logging |
ai-calls-without-object-id | Inference calls in the last seven days with no caller object ID. An empty value suggests a key and needs checking. | Know who is using your AI models | Log Analytics workspace, Logs, Queries, category AI model logging |
insider-keys-or-sas | The search behind the keys-or-sas alert, over the last seven days. | Notice data walking out the door | Log Analytics workspace, Logs, Queries, category Insider data theft |
insider-decrypt-rights | The search behind the decrypt-rights alert, over the last seven days. | Notice data walking out the door | Log Analytics workspace, Logs, Queries, category Insider data theft |
insider-logging-weakened | The search behind the logging-weakened alert, over the last seven days. | Notice data walking out the door | Log Analytics workspace, Logs, Queries, category Insider data theft |
insider-bulk-read | Callers who read the most from the sensitive accounts in the last hour. Only when sensitive_storage_account_ids is set. | Notice data walking out the door | Log Analytics workspace, Logs, Queries, category Insider data theft |
malicious-flows | Flows to or from addresses Microsoft rates malicious. | Keep network records long enough to be useful | Log Analytics workspace, Logs, Queries, category Investigation |
top-outbound-destinations | Busiest outbound destinations on the internet, last day. | Keep network records long enough to be useful | Log Analytics workspace, Logs, Queries, category Investigation |
one-address | Everything one private address talked to. Replace the address first. | Keep network records long enough to be useful | Log Analytics workspace, Logs, Queries, category Investigation |
entra-role-granted | The search behind the role-granted alert, over the last seven days. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
entra-app-credentials | The search behind the app-credentials alert, over the last seven days. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
entra-sign-in-changed | The search behind the sign-in-changed alert, over the last seven days. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
entra-mfa-changed-by-admin | The search behind the mfa-changed-by-admin alert, over the last seven days. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
entra-break-glass-sign-in | The search behind the break-glass-sign-in alert, over the last seven days. Only when break_glass_object_ids is set. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
entra-risky-sign-in | The search behind the risky-sign-in alert, over the last seven days. Only when risky_sign_in_alerts is true. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
entra-one-user | Everything one user did and every sign-in they made, last seven days. Replace the UPN first. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
entra-sign-ins-by-source | Sign-ins by user, address, and result, last 24 hours. | Catch account takeover at the identity provider Entra ID | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-mail-forwarded | The search behind the mail-forwarded alert, over the last seven days. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-transport-rule-redirect | The search behind the transport-rule-redirect alert, over the last seven days. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-mailbox-access-granted | The search behind the mailbox-access-granted alert, over the last seven days. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-audit-weakened | The search behind the audit-weakened alert, over the last seven days. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-guest-added-to-team | The search behind the guest-added-to-team alert, over the last seven days. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-bulk-download | Users ranked by distinct files downloaded or synced in the last hour. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-signals-silent | When each Microsoft 365 workload last sent a record. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
m365-one-user | Everything one user did in Microsoft 365, last seven days. Replace the UPN first. | Catch account takeover at the identity provider Microsoft 365 | Log Analytics workspace, Logs, Queries, category Identity provider signals |
Forensics on an Azure VM
- Disks. A snapshot covers one disk, so take one of the OS disk
and each data disk. Export with
az snapshot grant-access, which returns a read URL valid for at most 60 days. - Memory. Azure has no managed memory capture. Run Command runs a script as root or SYSTEM for up to 90 minutes, and returns only 4 KB of output, so have the capture tool write the image to storage.
- Chain of custody. Microsoft's reference architecture copies snapshots to immutable blob storage in a separate security subscription, under a legal hold, and keeps each hash in Key Vault.
- Where to look at it. An analysis machine with no route to the internet, reached through Bastion.
Detection you can switch on
| Service | What it adds |
|---|---|
| Defender for Cloud plans | Servers (Plan 1 brings Defender for Endpoint; Plan 2 adds agentless scanning, file integrity monitoring, and just-in-time access), Resource Manager, Storage, Key Vault, Containers, and more. Foundational posture management is free |
| Defender for Resource Manager | Suspicious management operations, known attack toolkits, and moves from the control plane into data |
| Entra ID Protection | Risky users and sign-ins. Most detections need P2; without it you see leaked credentials, anonymous IP addresses, and a generic "additional risk detected" |
| Workload identity risk | Leaked credentials and anomalous activity for service principals. Managed identities are not covered |
| Microsoft Sentinel | The SIEM, now run from the Defender portal. Microsoft ends support in the Azure portal after March 31, 2027 |
Containers on Azure
AKS adds a cluster audit log that is off until you add a diagnostic setting, nodes that repair and upgrades reimage, and OS disks that cannot be snapshotted. Containers on AKS and OKE covers each of these, and the container evidence template captures a compromised pod.