Blob Versioning & Soft Delete
Versioning · blob soft delete · container soft delete · point-in-time restore
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Which feature protects what
| Feature | Protects | Key points |
|---|---|---|
| Blob versioning | Every earlier state of a blob | Automatic on each write or delete. Off by default. Account-level setting. |
| Blob soft delete | Deleted or overwritten blobs, snapshots and versions | Retention 1 to 365 days. Restore with Undelete Blob. |
| Container soft delete | A deleted container with its blobs, versions and snapshots | Separate setting; retention 1 to 365 days, default 7. Restore Container. |
| Point-in-time restore | Block blobs in a container or range, reverted to an earlier time | Needs soft delete, change feed and versioning. |
| Resource lock | The storage account itself | Versioning and soft delete don't protect against account deletion. |
Blob versioning
- The version ID is the timestamp of the write. One current version, many previous versions. Previous versions are immutable.
- Operations that create a version: Put Blob, Put Block List, Copy Blob, Set Blob Metadata. Put Block does not. Delete Blob without a version ID makes the current version a previous version and leaves no current version.
- Blobs that existed before you enabled versioning have no version ID until they're modified.
- Restore by copying a previous version over the base blob (Copy Blob) to promote it. Undelete Blob restores soft-deleted versions but doesn't promote any to current.
- Supported: general-purpose v2 standard, premium block blob and legacy Blob accounts. Not supported on hierarchical namespace (ADLS Gen2) accounts.
- You can't disable versioning while an object replication policy exists. Disabling keeps existing versions; later writes aren't versioned.
- Versions stay, and are billed, until deleted. Use a lifecycle rule to delete or tier previous versions. Keep under 1,000 versions per blob.
- Delete a previous version: Storage Blob Data Owner (
deleteBlobVersion). Delete the current version: Storage Blob Data Contributor. - Microsoft recommends you stop taking manual snapshots of block blobs once versioning is on.
Soft delete
- Blob soft delete: retention 1 to 365 days, changeable any time (7 days or more is recommended). With versioning off, an overwrite creates a soft-deleted snapshot. With versioning on, an overwrite creates a previous version.
- Soft delete doesn't capture metadata or property writes; versioning captures Set Blob Metadata. It doesn't protect containers or accounts.
- If you disable blob soft delete, you can still recover soft-deleted objects until the retention period elapses.
- Container soft delete restores only to the original name: rename or delete any new container with that name first. It covers only containers deleted after you enable it. You can't restore single blobs from a soft-deleted container: restore the container first.
- Container soft delete doesn't protect single blob deletes in a live container. Keep both retention periods aligned: the shorter one limits what a restored container contains.
- Least-privilege role to restore a container: Storage Blob Data Contributor.
Point-in-time restore (PITR)
- General-purpose v2 standard accounts only; not hierarchical namespace. Block blobs in hot and cool tiers only.
- Prerequisites: blob soft delete, change feed and versioning enabled first. PITR retention must be at least one day shorter than blob soft delete retention (soft delete 7 gives PITR 1 to 6).
- Restore point is a UTC time within the retention period. Up to 10 ranges per operation, or omit ranges to restore all containers. One restore operation at a time; it can't be cancelled but can be undone with another restore.
- Range syntax: start inclusive, end exclusive. Whole container
myContainertomyContainer-0; virtual directoryc/dir/toc/dir0. No wildcards. - PITR can't restore deleted containers, page or append blobs, premium block blobs or archive-tier blobs. An archived blob in range fails the whole restore.
- Needs Storage Account Contributor. Turning on PITR in the portal also enables soft delete, versioning and change feed.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Enable versioning | az storage account blob-service-properties update --resource-group <rg> --account-name <n> --enable-versioning true | Update-AzStorageBlobServiceProperty -ResourceGroupName <rg> -StorageAccountName <n> -IsVersioningEnabled $true |
| List versions | az storage blob list --container-name <c> --account-name <n> --include v --auth-mode login | Get-AzStorageBlob -Container <c> -IncludeVersion -Context $ctx |
| Enable blob soft delete | az storage account blob-service-properties update ... --enable-delete-retention true --delete-retention-days 14 | Enable-AzStorageBlobDeleteRetentionPolicy -ResourceGroupName <rg> -StorageAccountName <n> -RetentionDays 14 |
| Enable container soft delete | az storage account blob-service-properties update --enable-container-delete-retention true --container-delete-retention-days 7 --account-name <n> --resource-group <rg> | Enable-AzStorageContainerDeleteRetentionPolicy -ResourceGroupName <rg> -StorageAccountName <n> -RetentionDays 7 |
| Enable change feed and versioning | ... --enable-change-feed true --enable-versioning true | Update-AzStorageBlobServiceProperty ... -EnableChangeFeed $true -IsVersioningEnabled $true |
| Enable PITR | ... --enable-restore-policy true --restore-days 7 | Enable-AzStorageBlobRestorePolicy -ResourceGroupName <rg> -StorageAccountName <n> -RestoreDays 7 |
| Restore all containers | az storage blob restore --resource-group <rg> --account-name <n> --time-to-restore 2026-11-12T06:31:22Z --no-wait | Restore-AzStorageBlobRange -ResourceGroupName <rg> -StorageAccountName <n> -TimeToRestore (Get-Date).ToUniversalTime().AddHours(-12) |
| Restore ranges | az storage blob restore ... --blob-range container3/d container3/g | New-AzStorageBlobRangeToRestore -StartRange container1 -EndRange container2, then Restore-AzStorageBlobRange -BlobRestoreRange $range ... |
| Check restore status | az storage account show --name <n> --resource-group <rg> --expand blobRestoreStatus --query blobRestoreStatus.status | $restoreOperation.Status |
Exam Tips
Tick each tip once you can answer it without looking.
“Recover an overwritten blob when versioning is on” → Copy the previous version over the base blob (promote it). Trap: Undelete Blob doesn't promote versions.
“What is a blob version ID?” → The timestamp of the write that created it. Trap: a sequential integer.
“Blob deleted with versioning on” → The current version becomes a previous version; no current version remains. Trap: everything is removed.
“Versioning on an ADLS Gen2 (hierarchical namespace) account” → Not supported. Trap: it works on every general-purpose v2 account.
“Can't turn versioning off” → An object replication policy exists: delete it first. Trap: soft delete being the blocker.
“Bill keeps growing after enabling versioning” → Previous versions persist: add a lifecycle rule to delete or tier them. Trap: shortening soft delete days.
“Delete one old version: which role?” → Storage Blob Data Owner. Trap: Storage Blob Data Contributor deletes the current version only.
“Accidentally deleted a whole container” → Container soft delete: restore the container. Trap: versioning, blob soft delete or PITR.
“Restore a container but a new one with the same name exists” → Rename or delete the new one first; restore is to the original name only. Trap: restoring under a new name.
“Prevent deletion of the storage account itself” → A resource lock (CanNotDelete). Trap: soft delete or versioning.
“Revert block blobs in a container to yesterday's state” → Point-in-time restore. Trap: container soft delete or Undelete Blob.
“PITR prerequisites” → Blob soft delete, change feed and versioning. Trap: container soft delete or snapshots.
“Soft delete is 7 days; PITR of 7 days is rejected” → PITR must be at least one day shorter: 6 or less. Trap: equal retention is allowed.
“PITR on a premium block blob or hierarchical namespace account” → Not supported: standard general-purpose v2 only. Trap: premium works.
“PITR fails because the container holds archived blobs” → Archive tier isn't supported and the whole restore fails: rehydrate first. Trap: archived blobs being skipped.
“Restore blobs starting with d to f in container1” → Range container1/d to container1/g (end exclusive). Trap: wildcards.
“Overwrite with versioning off and soft delete on” → A soft-deleted snapshot of the earlier state. Trap: a version.
“Metadata change lost” → Versioning captures Set Blob Metadata; soft delete does not.
“Blob soft delete is switched off after a blob was deleted” → The soft-deleted blob can still be recovered until the retention period elapses. Trap: assuming it is gone at once.
Sources
- Blob versioning overview
- Enable and manage blob versioning
- Soft delete for blobs
- Soft delete for containers
- Enable and manage soft delete for containers
- Point-in-time restore overview
- Perform a point-in-time restore
Checked against Microsoft Learn on November 13, 2026.