Skip to content

Add check: Key Vaults have soft-delete and purge protection enabled (#35041)#981

Open
krishna-sunkavalli wants to merge 1 commit intomicrosoft:mainfrom
krishna-sunkavalli:feature/keyvault-softdelete-purge-protection-check
Open

Add check: Key Vaults have soft-delete and purge protection enabled (#35041)#981
krishna-sunkavalli wants to merge 1 commit intomicrosoft:mainfrom
krishna-sunkavalli:feature/keyvault-softdelete-purge-protection-check

Conversation

@krishna-sunkavalli
Copy link

@krishna-sunkavalli krishna-sunkavalli commented Mar 2, 2026

Summary

Adds a new Azure Network Security check (Test ID: 35041) that validates all Azure Key Vaults have soft-delete and purge protection enabled.

Details

Attribute Value
Test ID 35041
Pillar Network
Category Azure Network Security
Risk Level High
Implementation Cost Low
User Impact Low

What it checks

Uses Azure Resource Graph to query all Key Vaults across subscriptions and verifies:

  • Soft-delete is enabled (prevents permanent deletion)
  • Purge protection is enabled (prevents force-purge during retention period)

Report output

Generates a per-vault compliance table with:

  • Vault name (linked to Azure Portal)
  • Subscription name
  • Soft-delete status
  • Purge protection status
  • Retention period (days)
  • Overall compliance status

Files added

  • \src/powershell/tests/Test-Assessment.35041.ps1\ - Assessment logic
  • \src/powershell/tests/Test-Assessment.35041.md\ - Remediation guidance with Azure CLI/PowerShell commands and Microsoft Learn links

Why this matters

Without soft-delete and purge protection, accidental or malicious deletion of Key Vaults results in permanent, irrecoverable loss of cryptographic keys, certificates, and secrets - potentially causing widespread service outages.

Motivation

This check was adapted from an independent Azure security posture assessment tool covering gaps not currently addressed by the Zero Trust Assessment. The ARG query and assessment logic have been converted to follow the official test format ([ZtTest()]\ attribute, \Invoke-ZtAzureResourceGraphRequest, markdown report generation, companion .md\ remediation file).


  • Follows one-function-per-file convention
  • Includes [ZtTest()]\ attribute with all required metadata
  • Companion .md\ file with %TestResult%\ placeholder
  • No trailing whitespace
  • No syntax errors
  • Uses \Invoke-ZtAzureResourceGraphRequest\ for ARG queries
  • Handles skip scenarios (NotConnectedAzure, NotSupported, NotApplicable)

…#35041)

Add a new Azure Network Security check that validates all Key Vaults
have soft-delete and purge protection enabled.

- Test ID: 35041
- Pillar: Network
- Category: Azure Network Security
- Risk Level: High

This check queries Azure Resource Graph to identify Key Vaults that
are missing soft-delete or purge protection, which are critical
recovery safeguards against accidental or malicious deletion.

Includes:
- Test-Assessment.35041.ps1: Assessment logic with per-vault
  compliance table and Azure Portal deep links
- Test-Assessment.35041.md: Remediation guidance with CLI/PowerShell
  commands and Microsoft Learn references
@krishna-sunkavalli
Copy link
Author

krishna-sunkavalli commented Mar 2, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants