azure.keyvault.purge-protection

Key vaults cannot be permanently deleted on demand

Every key vault has soft delete and purge protection enabled, so a deleted vault or secret survives its retention period and no principal can purge it early.

High Attested Preventive

Assertion

for every vault v: v.properties.enableSoftDelete == true and v.properties.enablePurgeProtection == true

Evaluated against az keyvault list; az keyvault show --name <vault>, collected daily.

Rationale

A key vault holds the secrets and keys that everything else depends on. Soft delete keeps a deleted vault, key, or secret recoverable for its retention period, and purge protection removes the ability to shorten that period. Together they mean that a mistaken deletion, a malicious one, or a compromised principal with delete rights cannot destroy a key and the data encrypted under it in one step. The recovery window is the control.

Observation

The collector lists the key vaults in each subscription and reads enableSoftDelete and enablePurgeProtection from each. Both must be true. Soft delete is on by default for new vaults and cannot be turned off, so in practice the assertion is about purge protection, which is opt-in and irreversible once set.

Remediation

az keyvault update --name <vault> --enable-purge-protection true

The change cannot be undone, which is the point. Where vaults are created in Terraform, set purge_protection_enabled = true on the azurerm_key_vault resource so that every vault starts compliant.