Azure – Point in Time restore is available in preview for block Blob

The point in time restore is now available in preview for Azure Storage Blob, helping increasing the protection against accidental deletion or block corruption.

There is few limitations with the preview:

  • Available in the following regions only
    • Canada Central
    • Canada East
    • France Central
  • Bloc uploaded with Put Block or Put Block from URL but not committed can not be restored as part of this scenario
  • Blob with active lease can not be restored; if the restore operation contains at least one blob with active lease, the entire restore process will fail
  • If a tier move (hot to cool) occurs between the restore operation is started and the restore point, the blob is restored in the previous tier
  • Blob moved to archive tier can not be restored

Also the following features need to be enabled (some are also in preview right now):

  • Soft delete
  • Change feed (preview)
  • Blob versioning (preview)

Only one point in time restore operation can be run at any given time on a storage account.

The point in time restore operation can not be stopped.

First things first, to be able to use this new feature you need to register the features required for the storage namespace with PowerShell (don’t forget you can still use Azure Cloud Shell https://shell.azure.com)

Register the Point In Time feature

Register-AzProviderFeature -ProviderNamespace Microsoft.Storage -FeatureName RestoreBlobRanges

image_thumb

Register the Change Feed feature (if not yet done)

Register-AzProviderFeature -ProviderNamespace Microsoft.Storage -FeatureName Changefeed

image_thumb[1]

Register the Blob Versioning (if not yet done)

Register-AzProviderFeature -ProviderNamespace Microsoft.Storage -FeatureName Versioning

image_thumb[2]

Refresh the Storage namespace

Register-AzResourceProvider -ProviderNamespace Microsoft.Storage

image_thumb[3]

Then if you create a new storage account, ensure the below options available at the Advanced step under the Data Protection section are enabled:

  • Blob soft delete
  • Blob change feed
  • Versioning

image_thumb[4]

If you use an existing storage account, these options can be enabled from the Data protection blade under the Blob service section

image_thumb[5]

Then you need to enable the retention period for the point in time using the below PowerShell command; the below command requires the use of the version 1.14.1-preview of the Az.Storage module

You can install the preview module using the command

Install-Module Az.Storage -Repository PSGallery -RequiredVersion 1.14.1-preview -AllowPrerelease -AllowClobber –Force

Enable-AzStorageBlobRestorePolicy -ResourceGroupName <resource group where your storage account is located> -StorageAccountName <storage account name> -RestoreDays <retention period>

Then you can restore containers and blob from a point in time using the command

Restore-AzStorageBlobRange -ResourceGroupName <resource group where your storage account is hosted> -StorageAccountName <your storage account> -TimeToRestore <point in time to restore – in UTC; you can use (Get-Date).AddHours(-<number of passed hours), like (Get-Date).AddHours(-12) to restore the 12 h ago>