Skip to content
Cloud Governance Tools

Key vaults should have deletion protection enabled

Key vaults should have deletion protection enabled is an Azure guardrail written in Azure Policy. Denies key vaults without purge protection and soft delete enabled, so keys and secrets cannot be purged during the retention period. Copied from a licensed open source set and read on 10 Nov 2026.

More encryption and keys guardrails ยท About Azure Policy

Built-in policy definition: Key vaults should have deletion protection enabled
Definition ID: 0b60c0b2-2dc2-4e1c-b5c9-abbed971de53
Category: Key Vault
Supported effects: Audit, Deny, Disabled
policyRule (copied from the repository file):
{
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.KeyVault/vaults"
        },
        {
          "field": "Microsoft.KeyVault/vaults/createMode",
          "notEquals": "recover"
        },
        {
          "anyOf": [
            {
              "allOf": [
                {
                  "value": "[requestContext().apiVersion]",
                  "less": "2019-09-01"
                },
                {
                  "anyOf": [
                    {
                      "field": "Microsoft.KeyVault/vaults/enableSoftDelete",
                      "equals": "false"
                    },
                    {
                      "field": "Microsoft.KeyVault/vaults/enableSoftDelete",
                      "exists": "false"
                    }
                  ]
                }
              ]
            },
            {
              "allOf": [
                {
                  "value": "[requestContext().apiVersion]",
                  "greaterOrEquals": "2019-09-01"
                },
                {
                  "field": "Microsoft.KeyVault/vaults/enableSoftDelete",
                  "equals": "false"
                }
              ]
            },
            {
              "field": "Microsoft.KeyVault/vaults/enablePurgeProtection",
              "exists": "false"
            },
            {
              "field": "Microsoft.KeyVault/vaults/enablePurgeProtection",
              "equals": "false"
            }
          ]
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]"
    }
  }
Blocks
Denies key vaults without purge protection and soft delete enabled, so keys and secrets cannot be purged during the retention period.
Breaks
Purge protection enforces a mandatory retention period: no one in your organization or Microsoft can purge the vault during the soft delete retention period. (source)
Test before applying
As for every Azure Policy guardrail: how to test before enforcing
Mechanism
Azure Policy (built-in definitions): Resources at the scope of the assignment (management group, subscription, resource group) and their children, except notScopes and exemptions
Taken from
open source set, MIT License, Azure/azure-policy repository, https://raw.githubusercontent.com/Azure/azure-policy/master/LICENSE

What the source says

"Malicious deletion of a key vault can lead to permanent data loss." (read 10 Nov 2026).

On what it breaks: "No one inside your organization or Microsoft will be able to purge your key vaults during the soft delete retention period."

Sources

  1. Key vaults should have deletion protection enabled, read 10 Nov 2026
  2. How to test it first, read 10 Nov 2026

Last reviewed 16 Nov 2026.