Information
Key vaults contain object keys, secrets, and certificates. Deletion of a key vault can cause immediate data loss or loss of security functions (authentication, validation, verification, non-repudiation, etc.) supported by the key vault objects.
It is recommended the key vault be made recoverable by enabling the "purge protection" function. This is to prevent the loss of encrypted data, including storage accounts, SQL databases, and/or dependent services provided by key vault objects (keys, secrets, certificates, etc.).
NOTE: In February 2025, Microsoft enabled soft delete protection on all key vaults. Users can no longer opt out of or turn off soft delete.
WARNING: A current limitation is that role assignments disappear when a key vault is deleted. All role assignments will need to be recreated after recovery.
Users may accidentally run delete/purge commands on a key vault, or an attacker or malicious user may do so deliberately in order to cause disruption. Deleting or purging a key vault leads to immediate data loss, as keys encrypting data and secrets/certificates allowing access/services will become inaccessible.
Enabling purge protection ensures that even if a key vault is deleted, the key vault and its objects remain recoverable during the configurable retention period. If no action is taken, the key vault and its objects will be purged once the retention period elapses.
Solution
Note: Once enabled, purge protection cannot be disabled.
Remediate from Azure Portal
- Go to Key Vaults.
- Click the name of a key vault.
- Under Settings, click Properties.
- Select the radio button next to Enable purge protection (enforce a mandatory retention period for deleted vaults and vault objects).
- Click Save.
- Repeat steps 1-5 for each key vault requiring remediation.
Remediate from Azure CLI
For each key vault requiring remediation, run the following command to enable purge protection:
az resource update --resource-group <resource-group> --name <key-vault> --resource-type "Microsoft.KeyVault/vaults" --set properties.enablePurgeProtection=true
Remediate from PowerShell
For each key vault requiring remediation, run the following command to enable purge protection:
Update-AzKeyVault -ResourceGroupName <resource-group> -VaultName <key-vault> -EnablePurgeProtection
Impact:
Once purge protection is enabled for a key vault, it cannot be disabled.