Enable and manage blob versioning

You can enable Blob storage versioning to automatically maintain previous versions of a blob when it is modified or deleted. When blob versioning is enabled, then you can restore an earlier version of a blob to recover your data if it is erroneously modified or deleted.

This article shows how to enable or disable blob versioning for the storage account by using the Azure portal or an Azure Resource Manager template. To learn more about blob versioning, see Blob versioning.

Enable blob versioning

You can enable blob versioning with the Azure portal, PowerShell, Azure CLI, or an Azure Resource Manager template.

To enable blob versioning for a storage account in the Azure portal:

  1. Navigate to your storage account in the portal.

  2. Under Data management, choose Data protection.

  3. In the Tracking section, select Enable versioning for blobs, and then choose whether to keep all versions or delete them after a period of time.

    Screenshot showing how to enable blob versioning in Azure portal

Important

If you set the Delete versions after option, a rule is automatically added to the lifecycle management policy of the storage account. Once that rule is added, the Delete versions after option no longer appears in the Data protection configuration page.

You can make that option reappear in the Data protection page by removing the rule. If your lifecycle management policy contains other rules that delete versions, then you'll have to remove those rules as well before the Delete versions after option can reappear.

List blob versions

To display a blob's versions, use the Azure portal, PowerShell, or Azure CLI. You can also list a blob's versions using one of the Blob Storage SDKs.

To list a blob's versions in the Azure portal:

  1. Navigate to your storage account in the portal, then navigate to the container that contains your blob.

  2. Select the blob for which you want to list versions.

  3. Select the Versions tab to display the blob's versions.

    Screenshot showing how to list blob versions in the Azure portal

  4. Toggle the Show deleted versions button to display soft-deleted versions. If blob soft delete is enabled for the storage account, then any soft-deleted versions that are still within the soft-delete retention interval will appear in the list.

    Screenshot showing how to list soft-deleted versions in Azure portal.

Next steps