Soft Delete (Azure)
Soft delete is an Azure data-protection feature that keeps deleted blobs, containers, file shares, or Key Vault objects in a recoverable state for a set retention period. It guards against accidental or malicious deletion.
Soft Delete (Azure)
With soft delete on, a delete marks the data as deleted but retains it, so you can undelete it until the retention period ends. Storage supports it for blobs, containers, and file shares with retention you choose, and Key Vault enforces it permanently with 7 to 90 days. Soft-deleted data is billed at normal storage rates until it expires.
What Does Soft Delete Not Cover?
It protects against deletes, not overwrites. Pair blob soft delete with blob versioning to recover from accidental overwrites too. It is also not a backup, and it does not stop someone with sufficient permissions from changing the data protection settings.
How Do You Enable It?
az storage account blob-service-properties update \ --account-name mumbaiprodstorage --resource-group mumbai-prod-rg \ --enable-delete-retention true --delete-retention-days 14 \ --enable-container-delete-retention true --container-delete-retention-days 14 # Recover a deleted blobaz storage blob undelete --account-name mumbaiprodstorage \ --container-name menu-images --name burger.png --auth-mode loginWhy It Matters in Production
Imagine an engineer at a delivery platform like Swiggy running a cleanup script against the wrong container. With soft delete on, the on-call team restores the data in minutes instead of rebuilding from backup.
TipCombine soft delete with versioning, resource locks, and immutability policies for defence in depth.
Common MistakeAssuming soft delete protects against a compromised account. An attacker with enough permissions can often disable it or purge data, so restrict who can change data protection settings.
Frequently Asked Questions
How long can deleted data be recovered?
For storage you set the retention period, from 1 to 365 days. Key Vault retention is 7 to 90 days, and once it expires the data is permanently removed.
Does soft delete cost money?
Yes. Soft-deleted data is billed like normal data for the whole retention period, so longer retention costs more.
What is the difference between soft delete and versioning?
Soft delete keeps data after a delete operation. Versioning keeps previous versions after an overwrite, so use both for full protection.