PIVTR-D
RAzure playbook · Data and storage

Key Vault secrets and keys stolen

An attacker with a role that writes the vault grants itself an access policy, or uses an identity that already has data access. The attacker then lists and reads secrets, backs up keys, or signs and decrypts with them, and these reads appear only in Key Vault resource logs. Remove the attacker's access and turn on purge protection first, then rotate every secret the caller could reach at its source system.

Look here

LogSearch for
AZKVAuditLogs (category AuditEvent)Secret and key reads by caller. Needs a diagnostic setting on each vault. Secret reads log as SecretGet, and version listing as SecretListVersions: AZKVAuditLogs | where OperationName startswith "Secret" or OperationName startswith "Key" | summarize count() by OperationName, tostring(Identity), CallerIpAddress, ResultSignature, _ResourceId
AzureDiagnosticsThe same data when the setting uses Azure diagnostics mode: AzureDiagnostics | where ResourceProvider == "MICROSOFT.KEYVAULT" and Category == "AuditEvent"
AZKVAuditLogs, vault changesVault changes, and the permission model that allowed each call. IsRbacAuthorized and IsAccessPolicyMatch show the model. Look for VaultPut, VaultPatch, VaultDelete and VaultAccessPolicyChangedEventGridNotification
AzureActivityAccess policy writes, vault updates and deletes, under Microsoft.KeyVault/vaults as accessPolicies/write, write and delete. Role assignments at vault scope log as: Microsoft.Authorization/roleAssignments/write
Vault settings nowThe permission model, access policies, firewall, public access and purge protection: az keyvault show -n <vault> --query "properties.{rbac:enableRbacAuthorization, policies:accessPolicies, network:networkAcls, public:publicNetworkAccess, purgeProtection:enablePurgeProtection}"
Vault role assignments nowAzure role assignments on the vault, including inherited ones: az role assignment list --scope <vault-id> --include-inherited
Managed HSM role assignmentsLocal role assignments on a Managed HSM: az keyvault role assignment list --hsm-name <hsm>
SecurityAlertDefender for Key Vault alerts KV_ListGetAnomaly, KV_PutGetAnomaly, KV_SuspiciousIPAccess, KV_TORAccess, KV_OperationVolumeAnomaly and KV_UnusualAccessSuspiciousIP, and Resource Manager alerts ARM_MicroBurst.AzKeyVaultSecretsREST, ARM_MicroBurst.AzKeyVaultKeysREST and Arm_Suspicious_Vault_Recovering

Contain

#Item
1Save the vault settings and role assignments above, and export the AuditEvent logs for the window
2Remove the attacker's access policy: az keyvault delete-policy -n <vault> --object-id <object-id>
3Remove the attacker's role assignments on the vault: az role assignment delete --ids <assignment-id>
4Remove the attacker's Managed HSM local role assignments: az keyvault role assignment delete --hsm-name <hsm> --assignee-object-id <object-id> --role <role> --scope /
5Set the vault firewall to deny by default. When private endpoints serve every client, use --public-network-access Disabled on the same command: az keyvault update -n <vault> -g <rg> --default-action Deny --bypass AzureServices
6Allow your known networks through the firewall: az keyvault network-rule add -n <vault> -g <rg> --ip-address <cidr>
7Turn on purge protection irreversible so deleted objects stay recoverable: az keyvault update -n <vault> -g <rg> --enable-purge-protection true
8Disable each exposed secret version after its replacement is live destructive for clients still using it: az keyvault secret set-attributes --vault-name <vault> -n <secret> --version <version> --enabled false

Eradicate and recover

#Item
1Rotate each secret read in the window at its source system, such as the database password or API key, then store the new value from a file: az keyvault secret set --vault-name <vault> -n <secret> --file <path>
2Rotate keys used without authorization. Keep old versions enabled until every service has re-wrapped its data keys: az keyvault key rotate --vault-name <vault> -n <key>
3List secrets the attacker deleted: az keyvault secret list-deleted --vault-name <vault>
4Recover each deleted secret: az keyvault secret recover --vault-name <vault> -n <secret>
5List deleted vaults: az keyvault list-deleted
6Recover a deleted vault: az keyvault recover -n <vault>
7Move the vault to Azure role-based access control (RBAC) after mapping each access policy to a role assignment: az keyvault update -n <vault> -g <rg> --enable-rbac-authorization true
8Send AuditEvent to the workspace for every vault and Managed HSM: az monitor diagnostic-settings create --name <name> --resource <vault-id> --workspace <workspace-id> --logs '[{"category":"AuditEvent","enabled":true}]'
Watch out
  • Secret and key reads are data-plane calls that reach only Key Vault resource logs. Without an AuditEvent setting in place during the attack, no record of which secrets were read exists, so treat every secret the caller could reach as exposed. Logs arrive within 10 minutes of each call.
  • Under the access policy model, any role with Microsoft.KeyVault/vaults/write, including Contributor and Key Vault Contributor, can grant itself data access. On a Managed HSM, Azure roles grant no key access, which comes only from local RBAC.
  • Key rotation creates a new version and leaves existing data encrypted under the old one. Services take from one hour to more than 24 hours to pick up a new version, so disabling the old version early breaks decryption.
  • Soft delete keeps deleted objects for 7 to 90 days. Purge protection cannot be turned off once on, and it blocks purges until that retention ends.

Microsoft Learn: AZKVAuditLogs table; Azure CLI reference for az keyvault, including soft delete retention and purge protection; Azure permissions for Security; Azure Monitor diagnostic settings. Key Vault logging (logs available at most 10 minutes after each operation); configure key autorotation (one hour to 24 hours or more for services to pick up a new version); Defender for Cloud alerts for Key Vault and Resource Manager. Checked October 2026. Key Vault monitoring data reference; soft-delete overview; Azure RBAC and access policies comparison; network security for Key Vault; Managed HSM logging and access control: checked September 2026.

Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.