Hardening Key Vault data protection: the basics
What does an under-protected Key Vault actually look like?
A Key Vault is the most leverage-dense object in an Azure subscription: it holds the secrets, keys and certificates that everything else trusts. Under-protection shows up in a handful of distinct shapes rather than one setting. Purge protection can be off, so a soft-deleted vault, or anyone with rights, can permanently erase its contents inside the recovery window. Soft delete governs whether a deleted vault is recoverable at all for a 7 to 90 day window. And keys can have no expiration date, so a cryptographic key created years ago is still valid today with no enforced point at which it must be rotated. Each is its own Defender for Cloud recommendation, but the underlying risk is the same: a store of cryptographic material that is easier to destroy, or that stays valid longer, than you meant.
Microsoft Defender for Cloud turns each of these into its own recommendation, which is why one vault-heavy subscription can fail several Key Vault checks at once. 'Key vaults should have purge protection enabled' and 'Key vaults should have soft delete enabled' both sit under the Microsoft Cloud Security Benchmark control DP-8 (back up and recover data), while 'Key Vault keys should have an expiration date' sits under DP-6 (use a secure key management process). They read as separate problems on the report, but they are one job: make sure the vaults you depend on can survive an accident or an insider, and that no key is allowed to live forever.
Most of this exposure is drift, not intent. A vault created before purge protection was considered, a key minted once and never given an expiry, a rotation policy that was never set. Since February 2025 Microsoft has made soft delete mandatory on every vault and it can no longer be disabled, so that recommendation is now satisfied by the platform. The remaining work is real: turn on purge protection so a recovery window cannot be cut short, and set an expiration date on every key so rotation is enforced rather than hoped for.
In this lesson you will learn how Azure Key Vault expresses recoverability and key lifetime, how to find every under-protected vault and every never-expiring key in a subscription, and how to harden them without breaking the workloads that depend on them. The Controls this lesson covers section lists every Defender for Cloud recommendation in this capability, each linking to a deep page with the exact check and a copy-and-paste fix.
The key that outlived the breach
Purge protection exists because of a specific failure mode: a soft-deleted vault can still be permanently purged inside its recovery window, by a disgruntled insider, a compromised account or an automation script that cleans up too aggressively, and once purged the keys are gone for good. If those keys encrypted a database, the data they protected becomes permanently unreadable. Microsoft made soft delete mandatory on all vaults in February 2025 precisely because accidental deletion was common, but purge protection, the setting that stops anyone cutting the recovery window short, is still opt-in. It is the one Key Vault setting that, once enabled, cannot be turned off again, by anyone, including Microsoft.
Finding Key Vault gaps across a subscription
Sam is the security lead at a scale-up preparing for its first ISO 27001 audit. Defender for Cloud shows Key Vault findings spread across a dozen vaults in two subscriptions that pre-date the team's current guardrails.
Rather than work the findings one by one, Sam starts by listing which vaults still lack purge protection and which keys still have no expiration date, so the production vaults that protect real data can be separated from empty test vaults before anything changes.
Start by listing the vaults that still lack purge protection. These are the ones whose recovery window can be cut short.
A production vault with soft delete on but purge protection unset is the highest-value target in this group: its keys can still be permanently destroyed inside the recovery window. Fix these first.
How Defender for Cloud decides a Key Vault is under-protecteddeep dive
Most Key Vault recommendations resolve to one of three properties. The first is 'enablePurgeProtection' on the vault: when it is unset, a soft-deleted vault can be permanently purged inside its recovery window, so the keys it holds can be destroyed for good before the window expires. The second is 'enableSoftDelete': it governs whether a deleted vault is recoverable at all for a configurable 7 to 90 day window, and since February 2025 Microsoft has made it mandatory on every vault and it can no longer be disabled, so that recommendation is now satisfied by the platform itself. The third is the 'expires' attribute on each key: when a key has no expiration date it is valid indefinitely, so there is no enforced point at which it must be rotated and a compromised key stays usable forever.
Defender for Cloud evaluates these against the Microsoft Cloud Security Benchmark on a periodic cycle, so a fix does not flip the recommendation to Healthy instantly. The control-plane change itself is immediate, but the posture catches up on the next assessment. This matters when you are gathering audit evidence against a deadline. Note also that purge protection is the one Key Vault setting that, once enabled, cannot be reversed: enable it deliberately, because you cannot turn it off again afterwards.
The strongest position combines the vault and key settings with an Azure Policy backstop: a deny or audit policy on purge protection ('Key vaults should have deletion protection enabled') means no new vault can be created without it, and a policy on key expiration ('Key Vault keys should have an expiration date') flags any key that lacks one. Pair the expiry date on each key with a rotation policy ('az keyvault key rotation-policy update'), where the expiry time has a minimum of 28 days, so rotated keys are reissued with a fresh expiry automatically. Turning those on is the difference between checking that nothing is under-protected today and guaranteeing that nothing can be created under-protected tomorrow.
What is the impact of leaving Key Vault under-protected?
The direct impact is irreversible loss. A vault without purge protection can be permanently purged inside its recovery window, by a compromised account, a departing insider or an automation script that cleans up too aggressively, and once the keys are gone the data they encrypted is permanently unreadable. A key with no expiration date stays valid indefinitely, so a key that is quietly compromised can be used for as long as the attacker holds it, with no enforced rotation to cut the exposure short. The overwhelming majority of these incidents were not attacks but accidents: a vault deleted by a wrong-scoped cleanup, a key that nobody ever set to expire.
The second-order impact is blast radius. A Key Vault is a single point of failure for everything that trusts it: databases encrypted with its keys, services that authenticate with its secrets, sites that serve its certificates. Losing one vault can take down a whole dependency tree at once. Hardening the vault, making it unpurgeable and forcing keys to rotate, shrinks that risk to a recoverable, time-boxed event rather than a permanent loss.
On the compliance side, every modern framework, ISO 27001, SOC 2, HIPAA, PCI DSS and the UK and EU data-protection regimes, expects evidence that cryptographic material is recoverable and that keys are rotated on a defined lifetime. A passing set of Key Vault recommendations across every subscription, with purge protection on and every key carrying an expiration date, is among the cheapest and most defensible artefacts you can hand an auditor.
How do you harden Key Vault safely?
Work the capability as one loop rather than chasing individual findings. The order matters: enable purge protection deliberately, because it cannot be reversed, and pair every key expiry with a rotation policy so you do not break a live workload when a key lapses.
1. Inventory every vault and key by protection
List the vaults that lack purge protection and the keys that have no expiration date. Treat this inventory as the source of truth, not the Defender finding count, because one vault and its keys can trigger several recommendations at once. Soft delete is now mandatory and on everywhere, so that part is already satisfied.
2. Separate production vaults from test drift
Decide what each vault actually protects. A vault holding the encryption keys for a regulated database is a catastrophic-loss item; an empty test vault is drift. Prioritise the vaults whose keys protect real data, because losing those is the outcome you are insuring against.
3. Enable purge protection and set key expiry, highest impact first
Enable purge protection on the production vaults (remember it cannot be turned off again), then set an expiration date on every key that lacks one and attach a rotation policy so rotated keys are reissued with a fresh expiry. Sequence expiry carefully: a key must be rotated before it expires, or the workload that depends on it fails.
4. Ratchet it shut with Azure Policy
Assign deny or audit policies so no new vault can be created without purge protection ('Key vaults should have deletion protection enabled') and so any key without an expiration date is flagged ('Key Vault keys should have an expiration date'). This makes the safe configuration enforced rather than merely encouraged, so the next vault is born hardened.
# Enable purge protection on every vault that lacks it. Note: this CANNOT be undone.
for kv in $(az keyvault list \
--query "[?properties.enablePurgeProtection==null].name" -o tsv); do
az keyvault update --name "$kv" --enable-purge-protection true
echo "$kv: purge protection enabled (irreversible)"
done
# Give a key an expiration date and a rotation policy so it rotates before it lapses.
az keyvault key set-attributes --vault-name kv-payments-prod \
--name db-encryption-key --expires "$(date -u -d '+1 year' +%Y-%m-%dT%H:%M:%SZ)"
az keyvault key rotation-policy update --vault-name kv-payments-prod \
--name db-encryption-key --value @rotation-policy.json
# Ratchet it shut: deny any future vault created without deletion protection.
az policy assignment create \
--name deny-kv-no-purge \
--policy 0b60c0b2-2dc2-4e1c-b5c9-abbed971de53 \
--scope "/subscriptions/00000000-0000-0000-0000-000000000000" Quick quiz
Question 1 of 5Defender for Cloud shows Key Vault findings across purge protection and key expiration on several vaults. What is the most efficient way to think about them?
You scored
0 / 5
Keep learning
Go deeper on how Azure Key Vault expresses recoverability and key lifetime across the settings in this capability.
- Azure Key Vault soft-delete overview How soft delete works, the 7 to 90 day recovery window, and why it is now mandatory.
- Azure Key Vault recovery management with soft delete and purge protection What purge protection enforces and why it cannot be disabled once enabled.
- Configure cryptographic key auto-rotation in Azure Key Vault How to set expiry and a rotation policy so keys are reissued before they lapse.
You can now treat Key Vault data protection as one capability rather than a scatter of findings: inventory the vaults without purge protection and the keys without an expiration date, separate the production vaults from test drift, enable purge protection and set key expiry highest-impact first, and ratchet the estate shut with Azure Policy. Soft delete is already on everywhere by default. The Controls this lesson covers section below links every recommendation in this group to its deep page and fix.
Back to the library