Azure Blob Storage Soft Delete

Protect your data from accidental deletions or overwrites with Blob Storage soft delete. This feature allows you to retain deleted blobs and snapshots for a specified period, enabling easy recovery.

What is Soft Delete?

Soft delete for Azure Blob Storage is a mechanism that protects your data by retaining deleted blobs, blob snapshots, and blob versions for a configurable retention period. Instead of permanently deleting the data immediately, it's marked for deletion and moved to a soft-deleted state. During this period, you can restore the blob to its previous state.

How it Works

When soft delete is enabled for your storage account, and a blob is deleted, it isn't immediately removed from the storage. Instead, the blob enters a soft-deleted state.

After the specified retention period expires, the soft-deleted data is permanently deleted by Azure Storage.

Soft Delete Workflow Diagram

Key Benefits

Enabling Soft Delete

Soft delete can be enabled at the storage account level. It's highly recommended to enable this feature when creating a new storage account or reviewing the configuration of existing ones.

Steps to Enable (Azure Portal):

  1. Navigate to your Azure Storage Account in the Azure portal.
  2. Under Data protection, select Soft delete for blobs.
  3. Toggle the switch to Enabled.
  4. Set the desired Retention period (in days, typically between 1 and 365).
  5. Click Save.

Restoring Soft-Deleted Blobs

Restoring a soft-deleted blob is a simple process:

Code Example (Azure CLI)

To restore a soft-deleted blob:

az storage blob undelete --container-name --name --account-name --account-key

Considerations