Imagine coming in on a Monday to find the staging database gone. Not broken, gone. The resource group is still there, the app is throwing connection errors, and nobody on the team remembers deleting anything. Was it a person, a pipeline, or a cleanup script? And can you get it back?
Azure keeps a record that can answer most of that, but only for a limited time, and only for certain kinds of operations.
The short version:
- The Azure Activity Log records management operations, such as creating, updating, and deleting resources, for 90 days.
- It doesn't record what happens inside a resource, such as deleting a blob or a Key Vault secret's value. That needs resource logs, which are off by default.
- Export the Activity Log to a Log Analytics workspace now, before you need it.
- The caller may be a person, or a GUID that belongs to a service principal; both can be traced.
- Alert on deletes, lock what matters, and know your recovery options before something disappears.
What the Activity Log records, and what it doesn't
Microsoft's Activity Log overview describes it as a record of subscription-level events from Azure Resource Manager: the control plane. That covers operations like creating a resource, changing its configuration, assigning a role, or deleting it. The documentation notes it doesn't typically capture read operations.
A few details matter during an investigation:
- It's not instant. Microsoft says events can take a few minutes, and sometimes up to about 20, to appear.
- Rejected attempts aren't there. If Resource Manager rejects a request during authentication or authorization, no Activity Log entry is written, so failed attempts by someone without permission won't show up.
- It's the only record of who created a resource. The same page notes the Activity Log is the only place that stores the creator of a resource.
The biggest limitation is what it doesn't see. Deleting a storage account appears in the Activity Log. Deleting a blob inside that storage account is a data-plane operation and doesn't. The same goes for reading or deleting Key Vault secrets and for changes to rows in a database. Those need resource logs, covered below.
Finding the delete
In the Azure portal, open the Activity Log for the subscription or resource group, set the time range, and filter by operation, resource, or status. A delete usually appears as an operation whose name ends in "delete" for that resource type.
The Activity Log event schema explains the fields worth reading:
- Caller: who performed the operation. For a user, this is usually their email or sign-in name; for an application, it's an identifier.
- Correlation ID: groups the events that belong to one operation.
- Status: administrative operations log more than one event, typically one when the operation starts and another with the final result. Look for the final, successful one.
- Client IP address: recorded in the event's HTTP request details. The schema notes those request details aren't included when you view an event in the Azure portal, because they may contain sensitive information. To see the IP, query exported data, where it appears as
CallerIpAddress, or read the event through the CLI or REST API.
Who is the caller?
If the caller is an email address, you know who to talk to. If it's a GUID, the operation was performed by an application identity, such as a service principal or managed identity. That's common for pipelines, automation, and infrastructure-as-code tools.
To trace a GUID:
- Look it up in Microsoft Entra ID as an enterprise application or managed identity, which gives you a name.
- From the application, find where it's used: an Azure DevOps service connection, a GitHub Actions workflow with federated credentials, an automation account, or a script.
- Then check that system's own logs for the run that matches the Activity Log timestamp.
One trap: some sample queries filter callers to entries containing an "@" sign, which keeps only user accounts. That's useful for some reports, but during an investigation it hides exactly the pipelines and scripts you may be looking for.
To find where a user signed in from, Microsoft Entra ID sign-in logs help, but their retention is short. Microsoft's data retention reference lists 7 days for Entra ID Free and 30 days for P1 and P2, and notes that upgrading isn't retroactive. If a delete is discovered after a week, the matching sign-in may already be gone unless you export those logs too.
90 days, then it's gone
The Activity Log overview is direct about retention: Azure keeps Activity Log events for 90 days and then deletes them. If a resource was deleted four months ago, the record is gone, unless you exported it.
Export works through a diagnostic setting on the subscription, sending events to a Log Analytics workspace, a storage account, or Event Hubs. A few points from Microsoft's documentation:
- Set it up per subscription. Even if you have a setting at the management group level, Microsoft notes some events don't reach the management group, so each subscription needs its own.
- The older methods are gone. The legacy collection methods, log profiles and the legacy Log Analytics connector, have been retired. Use diagnostic settings.
- Workspace retention matters. Per Microsoft's retention documentation, most Log Analytics tables keep data for 30 days by default, but the
AzureActivitytable is retained for at least 90 days at no charge. Microsoft's cost guidance also lists Activity Log data as free to ingest. If you need more than 90 days, set a longer retention on the table, which is billed.
Export is something to set up today. As far as the documentation describes, a diagnostic setting sends events from the time it's created, so it won't help with an incident that already happened.
Queries for deletes and role changes
Once Activity Log data is in a workspace, it lands in the AzureActivity table. Useful columns include OperationNameValue, Caller, CallerIpAddress, ActivityStatusValue, ResourceId, and CorrelationId.
To find deletes, filter on operations whose name ends in /DELETE, for example AzureActivity | where OperationNameValue endswith "/DELETE", then narrow by resource or time range and project the caller, resource ID, IP address, and status.
Watch the status values. Microsoft's own sample queries filter on "Success," while the schema documentation describes the final status as "Succeeded." Matching either, with ActivityStatusValue in~ ("Success", "Succeeded"), avoids missing results.
For permission changes, Azure RBAC's change history guide uses the operations Microsoft.Authorization/roleAssignments/write and Microsoft.Authorization/roleAssignments/delete. A role granted shortly before a delete, or removed right after, is worth a closer look.
To see everything that happened as part of one action, filter by its CorrelationId.
When the delete happened inside a resource
For data-plane operations, you need resource logs. Microsoft's documentation is consistent that resource logs aren't collected by default and need a diagnostic setting on each resource:
- Key Vault: the Key Vault logging guide records operations in the
AuditEventcategory, including secret deletes and purges. - Blob storage: the Blob Storage monitoring guide sends operations to the
StorageBlobLogstable, and notes that these logs are recorded on a best-effort basis.
If those settings weren't in place when the data was deleted, there may be no record of who did it.
Recent changes: Resource Graph change history
Azure Resource Graph keeps a short history of resource changes. Microsoft's change analysis documentation says changes are queryable for 14 days at no extra cost, and include who made the change and with which type of client. It's useful for "what changed on this resource last week," but it doesn't keep a copy of a resource after it's deleted, and 14 days goes quickly.
Alert on deletes
Finding out from an alert is better than finding out on Monday. Azure Monitor supports activity log alert rules that fire when a specific administrative operation happens, such as deleting a database server or a Key Vault, and send notifications through an action group.
Three things to know:
- Check the cost on the Azure Monitor pricing page, including notifications sent through action groups.
- They're limited. The service limits allow 100 active Activity Log alert rules per subscription, and the limit can't be raised. Alert on the resource types that matter most rather than everything.
- They're stateless. Microsoft's alerts overview says all activity log alerts are stateless: each matching event triggers the alert, and there's no "resolved" state.
A role assignment change on a production subscription is also worth an alert.
Prevent it with locks
Resource locks stop accidental deletes. A delete lock blocks deletion of the resource until the lock is removed. The documentation is clear about their limits:
- They apply only to control-plane operations. A lock on a storage account doesn't protect the data inside it from being deleted.
- They can be removed by people with the right roles, such as Owner or User Access Administrator. A lock adds a deliberate step; it isn't a permission boundary.
Lock production databases, storage accounts, and Key Vaults, and alert when a lock is removed.
Can you get it back?
Recovery depends entirely on the resource type and on settings that had to be in place beforehand. As of November 2026, Microsoft documents:
- Key Vault: soft delete is on by default, with a retention period of 7 to 90 days chosen when the vault is created. Purge protection, which prevents permanent deletion during that period, is off by default.
- Blobs: blob soft delete can keep deleted blobs for 1 to 365 days, but only if it was enabled before the deletion.
- Storage accounts: a deleted account can sometimes be recovered within 14 days, on a best-effort basis.
- Azure SQL Database: a deleted database can be restored from backups within its retention period, but a deleted server can't be restored.
- Azure Database for PostgreSQL flexible server: a deleted server can be restored within five days, using details from the delete event in the Activity Log. Another reason to keep that log.
- Resource groups: a deleted resource group can't be recovered. Individual resources inside it may still be recoverable through their own mechanisms.
Check these settings for your important resources now. Most recovery options can't be turned on after the fact.
When it's an incident
Sometimes "who deleted this" turns into a security incident. In the EU, GDPR Article 33 requires controllers to notify the supervisory authority of a personal data breach within 72 hours of becoming aware of it, where feasible, and to document breaches. Organizations within the scope of the NIS2 Directive face incident-handling requirements and, for significant incidents, an early warning within 24 hours. Logs that already exist, and are kept long enough, are what make those timelines achievable.
Setup checklist
- Export the Activity Log from every subscription with a diagnostic setting to a Log Analytics workspace.
- Decide on retention: 90 days is free for Activity Log data; extend it if your audits or investigations need longer.
- Export Entra ID sign-in and audit logs if 7 or 30 days isn't enough.
- Enable resource logs for Key Vaults, storage accounts, and databases where data-plane deletes matter.
- Save queries for deletes, role assignment changes, and correlation, matching both status spellings.
- Know how to trace a GUID caller to its application, pipeline, or script.
- Alert on deletes and role changes for the resources that matter most, within the 100-rule limit.
- Lock critical resources, and alert when locks are removed.
- Turn on soft delete and purge protection where available, before you need them.
- Practice once: delete a test resource and find it in the logs.



