Lesson 3 of 5 Azure Blob Storage Data Management

Recovering Data with Blob and Container Soft Delete

Soft delete keeps deleted blobs and containers recoverable for a retention period. This lesson explains how each feature works and its limits.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe blob soft delete and how soft-deleted blobs are restored.
  • Describe container soft delete and the conditions for restoring a container.
  • Identify what soft delete does not protect against.

Blob soft delete

With blob soft delete enabled on the account's Data protection page, a deleted blob, or a deleted snapshot, is kept in a soft-deleted state for the retention period of 1 to 365 days. When versioning is not enabled, overwriting a blob also saves its previous content as a soft-deleted snapshot. Soft-deleted blobs are invisible to normal list operations; in the portal, Show deleted blobs displays them, and Undelete (or az storage blob undelete) restores them along with their snapshots.

Soft-deleted data is billed at the same rate as active data, and after the retention period it is permanently deleted.

True or false

Blob soft delete

Exam skills 2.3.4

Check how blob soft delete keeps and restores deleted data.

Log in to try this activity Interactive activities are free with an account.

Container soft delete

Container soft delete protects whole containers. A deleted container and all its blobs, versions and snapshots are kept for 1 to 365 days and can be restored from the containers list with Show deleted containers. A container can be restored only to its original name, and only if no new container with that name has been created. Container soft delete does not protect individual blobs deleted from an existing container; that requires blob soft delete or versioning.

Accounts created in the portal enable blob and container soft delete with seven days of retention by default. Neither feature protects against deletion of the storage account itself, which requires a CanNotDelete resource lock; a deleted storage account can sometimes be recovered within 14 days if its name has not been reused, but this is not guaranteed.

The following diagram shows the steps to restore a soft-deleted container when a new container with the same name has since been created.

Recovering a container deleted four days ago when a developer has since created a new, empty container with the same name. A soft-deleted container can be restored only under its original name and only when no container with that name exists, so the new one is deleted or renamed first, then the old one restored from Show deleted containers.
The scenario is illustrative.
Troubleshooting

Getting deleted data back

Exam skills 2.3.4

Find the fix for each recovery problem.

Log in to try this activity Interactive activities are free with an account.
Worked example

Recovering deleted data

An administrator deleted the container invoices four days ago. The account has container soft delete with 14 days of retention and blob soft delete with 7 days of retention. A developer has since created a new, empty container named invoices. How can the data be recovered?

A soft-deleted container can be restored only under its original name and only when no container with that name exists, so first delete or rename the developer's new invoices container (after moving its contents, if any), then restore the soft-deleted container from Show deleted containers. Blob soft delete does not help, because the blobs were deleted as part of the container, which container soft delete protects.

Check yourself

Does container soft delete protect a blob deleted from a container that still exists?

Show answer

No. It protects whole deleted containers; individual blobs need blob soft delete or versioning.

Exam Tips

Remember for the exam

  • Retention for blob and container soft delete is 1 to 365 days.
  • A container is restored only to its original name, if that name is free.
  • Soft-deleted data is billed like active data.
  • Protect the storage account itself with a CanNotDelete lock.