Description
Soft delete is enabled by default on new Key Vaults and cannot be turned off. Set enablePurgeProtection: true to prevent even an authorized purge during retention. Enabling purge protection is also permanent.
Potential impact
Losing a key, secret or certificate can interrupt a service or leave data unreadable. A service can still be interrupted by the initial deletion.
Remediation
Choose the fixed 7–90 day retention period when creating the vault. Restrict delete, purge and recover permissions, maintain backups and test recovery. After restoring a vault, recreate its required RBAC role assignments and Event Grid subscriptions.
Examples
Both examples use 80 days and Azure RBAC. Supply a unique vaultName and the required data roles, and check the deployment, disk-encryption and network settings for your workload.
Before
param vaultName string
resource keyVaultInstance 'Microsoft.KeyVault/vaults@2019-09-01' = {
name: vaultName
location: resourceGroup().location
tags: {}
properties: {
tenantId: subscription().tenantId
sku: {
family: 'A'
name: 'standard'
}
accessPolicies: []
enabledForDeployment: true
enabledForDiskEncryption: true
enabledForTemplateDeployment: true
enableSoftDelete: true
softDeleteRetentionInDays: 80
enableRbacAuthorization: true
}
}
Omitting purge protection on a new vault allows a permitted identity to purge during retention.
After
param vaultName string
resource keyVaultInstance 'Microsoft.KeyVault/vaults@2019-09-01' = {
name: vaultName
location: resourceGroup().location
tags: {}
properties: {
tenantId: subscription().tenantId
sku: {
family: 'A'
name: 'standard'
}
accessPolicies: []
enabledForDeployment: true
enabledForDiskEncryption: true
enabledForTemplateDeployment: true
enableSoftDelete: true
softDeleteRetentionInDays: 80
enableRbacAuthorization: true
enablePurgeProtection: true
}
}