How the attack works
Deleting a key vault (Microsoft.KeyVault/vaults/delete) takes its keys, secrets and certificates out of reach of everything that uses them. With soft delete, which is on by default for new vaults and cannot be turned off once enabled, the vault stays recoverable for a retention period of 7 to 90 days. Purging the deleted vault (Microsoft.KeyVault/locations/deletedVaults/purge/action) ends that: Microsoft describes it as the immediate and irrecoverable deletion of the vault. Purge protection blocks a purge until the retention period has passed, but it is optional and not enabled by default.
Microsoft's documentation names the scenario itself: a rogue user deletes a key vault to cause a business disruption. Applications lose their secrets at once, and services that encrypt data with keys from the vault lose access to those keys. If the vault is then purged, the keys are gone permanently, together with any data that only they can decrypt. Both operations are control-plane requests recorded in the Azure Activity log with their caller. Managed HSMs have the equivalent operations Microsoft.KeyVault/managedHSMs/delete and Microsoft.KeyVault/locations/deletedManagedHsms/purge/action. Deleting or purging a single secret, key or certificate inside a vault is a data-plane request that only the vault's own resource log records, as operations such as SecretDelete and KeyPurge. Two further rules read that log, one for every purge of an object and one for many deletions from one vault by one address.
What an attacker needs
- To delete:
Microsoft.KeyVault/vaults/deleteon the vault (Owner, Contributor, Key Vault Contributor or a custom role). - To purge:
Microsoft.KeyVault/locations/deletedVaults/purge/action. Microsoft states that in general only the subscription owner or a user with the Key Vault Purge Operator role can purge a key vault, and the Key Vault Contributor role excludes the action. - For permanent loss: a vault without purge protection.
Impact
An outage of every application and service that reads secrets, keys or certificates from the vault. Recovery does not bring everything back: Microsoft documents that the Azure role assignments and Event Grid subscriptions of a soft-deleted vault are deleted and must be created again. After a purge, the vault's contents are lost permanently, and so is the data that was encrypted only under its keys.
Detection rules
Azure Soft-Deleted Key Vault or Managed HSM Purged
Detects a successful purge of a soft-deleted Azure key vault or Managed HSM. Microsoft describes the purge of a key vault as its immediate and irrecoverable deletion. The purge is possible only when purge protection is not enabled on the vault.
title: Azure Soft-Deleted Key Vault or Managed HSM Purged
id: 4869d65d-5c15-448f-a26b-cecf8cbf30b9
status: experimental
description: >-
Detects a successful purge of a soft-deleted Azure key vault or Managed HSM.
Microsoft describes the purge of a key vault as its immediate and
irrecoverable deletion. The purge is possible only when purge protection is
not enabled on the vault.
references:
- https://attack.mitre.org/techniques/T1485/
- https://learn.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview
- https://learn.microsoft.com/en-us/azure/key-vault/general/key-vault-recovery
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/security
author: Forestall
date: 2026-11-16
tags:
- attack.impact
- attack.t1485
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue:
- MICROSOFT.KEYVAULT/LOCATIONS/DELETEDVAULTS/PURGE/ACTION
- MICROSOFT.KEYVAULT/LOCATIONS/DELETEDMANAGEDHSMS/PURGE/ACTION
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Pipelines in development and test subscriptions that purge a deleted vault to reuse its name, which stays reserved during the retention period. Exclude their identities in a filter_ selection by Caller, and keep alerting on every purge in production subscriptions.
level: high
False positives
- Pipelines in development and test subscriptions that purge a deleted vault to reuse its name, which stays reserved during the retention period. Exclude their identities in a filter_ selection by Caller, and keep alerting on every purge in production subscriptions.
Many Secrets, Keys or Certificates Deleted From One Key Vault by One Address
Counts, per caller IP address and key vault, the successful deletions of secrets, keys and certificates (operations SecretDelete, KeyDelete and CertificateDelete). Applications and their owners delete an object now and then, for example an old secret after a rotation. Ten or more deletions from one address within 30 minutes mean that one client is emptying the vault while the vault itself stays in place, which takes the secrets away from the applications at once and is the step before a purge. Deleted objects stay recoverable for the retention period of the vault. The identity claims of the record are not mapped as fields, so the rule groups by address and vault, and the caller has to be named from the matching records. The count and the window are starting points. The log exists only where a diagnostic setting on the vault exports the AuditEvent category.
Fires when one combination of CallerIpAddress and ResourceId has at least 10 matching events within 30 minutes.
title: Key Vault Secret, Key or Certificate Deleted (Threshold Base Event)
id: 0edec63a-3e42-41a7-8e65-22012105d9ac
name: key_vault_object_deleted
status: experimental
description: >-
Base event of the threshold rule in this file. A successful deletion of a
secret, key or certificate inside an Azure key vault (operations
SecretDelete, KeyDelete and CertificateDelete in the vault's AuditEvent
resource log).
logsource:
product: azure
service: keyvault
detection:
selection:
OperationName:
- SecretDelete
- KeyDelete
- CertificateDelete
ResultType: Success
condition: selection
level: low
---
title: Many Secrets, Keys or Certificates Deleted From One Key Vault by One Address
id: 3155f182-28eb-4b46-94e1-a6128804a37e
status: experimental
description: >-
Counts, per caller IP address and key vault, the successful deletions of
secrets, keys and certificates (operations SecretDelete, KeyDelete and
CertificateDelete). Applications and their owners delete an object now and
then, for example an old secret after a rotation. Ten or more deletions from
one address within 30 minutes mean that one client is emptying the vault
while the vault itself stays in place, which takes the secrets away from the
applications at once and is the step before a purge. Deleted objects stay
recoverable for the retention period of the vault. The identity claims of
the record are not mapped as fields, so the rule groups by address and vault,
and the caller has to be named from the matching records. The count and the
window are starting points. The log exists only where a diagnostic setting on
the vault exports the AuditEvent category.
references:
- https://attack.mitre.org/techniques/T1485/
- https://learn.microsoft.com/en-us/azure/key-vault/general/logging
- https://learn.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview
- https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azkvauditlogs
author: Forestall
date: 2026-11-18
tags:
- attack.impact
- attack.t1485
correlation:
type: event_count
rules:
- key_vault_object_deleted
group-by:
- CallerIpAddress
- ResourceId
timespan: 30m
condition:
gte: 10
falsepositives:
- Clean-up scripts that remove expired or test secrets in one run, and the teardown of an application that deletes its objects before its vault. Exclude their addresses once confirmed, or raise the count for those vaults.
- The values of 10 deletions and 30 minutes are starting points, not tested limits. A vault with fewer objects than the count can never match, so set the count per vault size where you can.
level: medium
False positives
- Clean-up scripts that remove expired or test secrets in one run, and the teardown of an application that deletes its objects before its vault. Exclude their addresses once confirmed, or raise the count for those vaults.
- The values of 10 deletions and 30 minutes are starting points, not tested limits. A vault with fewer objects than the count can never match, so set the count per vault size where you can.
Key Vault Secret, Key or Certificate Purged
Detects the successful purge of a soft-deleted secret, key or certificate inside an Azure key vault (operations SecretPurge, KeyPurge and CertificatePurge in the vault's AuditEvent resource log). Microsoft documents that permanently deleting a secret takes two operations, a delete that puts the object into the soft-deleted state and a purge of that state, so the purge is the step that cannot be undone. A purged key takes with it the data that was encrypted only under it. With purge protection on, a deleted object cannot be purged until its retention period has passed. The operation is a data-plane request of the vault and does not appear in the Azure Activity log. The log exists only where a diagnostic setting on the vault exports the AuditEvent category.
title: Key Vault Secret, Key or Certificate Purged
id: 27302b7b-207a-4b92-b57e-4b2222186115
status: experimental
description: >-
Detects the successful purge of a soft-deleted secret, key or certificate
inside an Azure key vault (operations SecretPurge, KeyPurge and
CertificatePurge in the vault's AuditEvent resource log). Microsoft documents
that permanently deleting a secret takes two operations, a delete that puts
the object into the soft-deleted state and a purge of that state, so the
purge is the step that cannot be undone. A purged key takes with it the data
that was encrypted only under it. With purge protection on, a deleted object
cannot be purged until its retention period has passed. The operation is a
data-plane request of the vault and does not appear in the Azure Activity
log. The log exists only where a diagnostic setting on the vault exports the
AuditEvent category.
references:
- https://attack.mitre.org/techniques/T1485/
- https://learn.microsoft.com/en-us/azure/key-vault/general/logging
- https://learn.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview
- https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azkvauditlogs
author: Forestall
date: 2026-11-18
tags:
- attack.impact
- attack.t1485
logsource:
product: azure
service: keyvault
detection:
selection:
OperationName:
- SecretPurge
- KeyPurge
- CertificatePurge
ResultType: Success
condition: selection
falsepositives:
- Pipelines in development and test vaults that purge a deleted object to reuse its name, which stays reserved while the object is soft-deleted. Exclude their addresses in a filter_ selection by CallerIpAddress once confirmed, and keep alerting on every purge in production vaults.
level: high
False positives
- Pipelines in development and test vaults that purge a deleted object to reuse its name, which stays reserved while the object is soft-deleted. Exclude their addresses in a filter_ selection by CallerIpAddress once confirmed, and keep alerting on every purge in production vaults.
Azure Key Vault or Managed HSM Deleted
Detects a successful deletion of an Azure key vault or a Managed HSM. The vault's keys, secrets and certificates become unavailable to every application and service that uses them. With soft delete the vault stays recoverable for its retention period, unless it is purged.
title: Azure Key Vault or Managed HSM Deleted
id: 61b9bea1-d81c-4fb5-ada0-e0a44055efac
status: experimental
description: >-
Detects a successful deletion of an Azure key vault or a Managed HSM. The
vault's keys, secrets and certificates become unavailable to every
application and service that uses them. With soft delete the vault stays
recoverable for its retention period, unless it is purged.
references:
- https://attack.mitre.org/techniques/T1485/
- https://learn.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/security
author: Forestall
date: 2026-11-16
tags:
- attack.impact
- attack.t1485
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue:
- MICROSOFT.KEYVAULT/VAULTS/DELETE
- MICROSOFT.KEYVAULT/MANAGEDHSMS/DELETE
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Planned decommissioning and test environments that are torn down by infrastructure-as-code pipelines. Correlate with change records and exclude the deployment identities of non-production subscriptions in a filter_ selection by Caller.
level: medium
False positives
- Planned decommissioning and test environments that are torn down by infrastructure-as-code pipelines. Correlate with change records and exclude the deployment identities of non-production subscriptions in a filter_ selection by Caller.
Triage
- Identify the Caller and the vault, and check for an approved decommissioning. For a purge, the deleted vault is named in the resource ID of the event.
- Find out whether the vault had purge protection and what depended on it, such as applications that read its secrets and services that encrypt data with its keys.
- Look for a delete followed by a purge by the same caller, and for deletions of several vaults, backups, snapshots or storage accounts in the same period.
- Review the caller's recent sign-ins and how it obtained the role that allowed the deletion.
Response
Once the attack is confirmed:
- If the vault is only soft-deleted, recover it at once, before anyone can purge it. Then create again what recovery does not restore, namely its Azure role assignments and its Event Grid subscriptions.
- Contain the caller. Revoke its sessions, rotate its credentials and remove its roles on the vault's subscription, the purge permission included.
- Enable purge protection on the recovered vault and on the other vaults the caller could reach.
- If the vault was purged, nothing can be recovered from Azure. Restore keys and secrets from backups where they exist, issue new secrets and certificates to the applications, and list the data that was encrypted under the lost keys.
- Confirm that the applications and the services that use the vault's keys work again, and review the Activity log for other destructive operations by the same caller.
Mitigation
- Enable purge protection on every vault. Once enabled it cannot be disabled, and a deleted vault cannot be purged until its retention period has passed. Enforce it with the built-in Azure Policy definition Key vaults should have deletion protection enabled.
- Limit Owner, Contributor and Key Vault Contributor on vaults and on the scopes above them, and assign them through Privileged Identity Management.
- Keep the purge permission out of standing role assignments, and grant the Key Vault Purge Operator role only for a planned purge.
- Put a CanNotDelete resource lock on vaults that production depends on. Microsoft documents that deleting a lock needs the
Microsoft.Authorization/locks/*actions, which Owner and User Access Administrator have. - Send the Azure Activity log to your SIEM, so the deletion is seen while the vault can still be recovered.
Frequently asked questions
Can a deleted key vault be recovered?
Yes, while it is in the soft-deleted state. Soft delete is on by default for new vaults and cannot be turned off once enabled, and a deleted vault stays recoverable for its retention period of 7 to 90 days. Recovery does not restore everything. Microsoft documents that the vault's Azure role assignments and Event Grid subscriptions are deleted with it and must be created again.
What does purge protection change?
With purge protection on, a deleted vault cannot be purged by anyone until its retention period has passed. Without it, a principal that holds the purge permission can delete the vault immediately and irrecoverably. Purge protection is optional and is not enabled by default, so check it on every vault. Once enabled, it cannot be disabled.
Why do the vault delete and vault purge rules have different levels?
A delete is disruptive, but it can be reversed during the retention period, and vaults are also deleted in normal decommissioning. That rule is medium. A purge removes the safety net and cannot be undone, so that rule is high. A delete followed by a purge by the same caller is the pattern that needs the fastest response.
Do the rules see a key, secret or certificate deleted inside a vault?
Two of them do. Deleting or purging an individual key, secret or certificate is a data-plane operation of the vault. It is recorded in the vault's resource logs (AuditEvent) when a diagnostic setting collects them, and not in the Azure Activity log. One rule reads every purge of an object there, and one counts the deletions from one vault by one address. Without that diagnostic setting, neither has anything to read.
References
- MITRE ATT&CK T1485: Data Destruction
- Azure Key Vault: soft-delete overview
- Azure Key Vault recovery overview
- Azure permissions for Security
- Azure built-in roles for Security
- Lock your Azure resources to protect your infrastructure
- Azure Key Vault logging
- AZKVAuditLogs table reference
- List of built-in policy definitions for Azure Policy