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:
Navigate to your storage account in the portal.
Under Blob service, choose Data protection.
In the Versioning section, select Enabled.
To enable blob versioning for a storage account with PowerShell, first install the Az.Storage module version 2.3.0 or later. Then call the Update-AzStorageBlobServiceProperty command to enable versioning, as shown in the following example. Remember to replace the values in angle brackets with your own values:
# Set resource group and account variables.
$rgName = "<resource-group>"
$accountName = "<storage-account>"
# Enable versioning.
Update-AzStorageBlobServiceProperty -ResourceGroupName $rgName `
-StorageAccountName $accountName `
To enable blob versioning for a storage account with Azure CLI, first install the Azure CLI version 2.2.0 or later. Then call the az storage account blob-service-properties update command to enable versioning, as shown in the following example. Remember to replace the values in angle brackets with your own values:
Navigate to your storage account in the portal, then navigate to the container that contains your blob.
Select the blob for which you want to list versions.
Select the Versions tab to display the blob's versions.
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.
To list a blob's versions with PowerShell, call the Get-AzStorageBlob command with the -IncludeVersion parameter: