Enable soft delete for blobs

Blob soft delete protects an individual blob and its versions, snapshots, and metadata from accidental deletes or overwrites by maintaining the deleted data in the system for a specified period of time. During the retention period, you can restore the blob to its state at deletion. After the retention period has expired, the blob is permanently deleted. For more information about blob soft delete, see Soft delete for blobs.

Blob soft delete is part of a comprehensive data protection strategy for blob data. To learn more about Azure's recommendations for data protection, see Data protection overview.

Enable blob soft delete

You can enable or disable soft delete for a storage account at any time by using the Azure portal, PowerShell, or Azure CLI.

Blob soft delete is enabled by default when you create a new storage account with the Azure portal. The setting to enable or disable blob soft delete when you create a new storage account is on the Data protection tab. For more information about creating a storage account, see Create a storage account.

To enable blob soft delete for an existing storage account by using the Azure portal, follow these steps:

  1. In the Azure portal, navigate to your storage account.
  2. Locate the Data Protection option under Data management.
  3. In the Recovery section, select Turn on soft delete for blobs.
  4. Specify a retention period between 1 and 365 days. We recommend a minimum retention period of seven days.
  5. Save your changes.

Screenshot showing how to enable soft delete in the Azure portal

Enable blob soft delete (hierarchical namespace)

Blob soft delete can also protect blobs and directories in accounts that have the hierarchical namespace feature enabled on them.

To enable blob soft delete for your storage account by using the Azure portal, follow these steps:

  1. In the Azure portal, navigate to your storage account.
  2. Locate the Data Protection option under Data Management.
  3. In the Recovery section, select Enable soft delete for blobs.
  4. Specify a retention period between 1 and 365 days. Azure recommends a minimum retention period of seven days.
  5. Save your changes.

Screenshot showing how to enable soft delete in the Azure portal in accounts that have a hierarchical namespace.

Next steps