Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure blob soft delete and versioning- how to restore files easily?

I am trying to understand how soft delete and versioning work within azure blog storage.

It seems that if you have both soft delete and versioning turned on... you can’t just ‘undelete ’ deleted files, as versioning actually saves a new version as a deleted file.

So instead you have to promote the last version of each deleted file.

But what if you have a structure of nested folders and thousands of blobs... you can’t just promote the top version of the top level folder... you need to use Powershell to list files with no current version, and promote them? How would you do this?

This seems awfully complicated, when without versioning - a simple ‘undelete’ command is available from the GUI.

Am I missing something? What is the easiest way to ‘undelete’ a nested folder structure of thousand of blobs in folders, when versioning is turned on?

Thanks

like image 468
Mike Edwards Avatar asked Oct 19 '25 13:10

Mike Edwards


1 Answers

As Rob Minson pointed out, the approach involves copying a blob version to the same container. For PowerShell, use the Copy-AzStorageBlob cmdlet; for Azure CLI, use the az storage blob copy start command. You can pass an account key or SAS token, or use Azure AD.

We've updated the documentation to shed some light on an approach to restoring blobs when soft-delete and/or versioning is enabled. Code samples are available for both PowerShell and Azure CLI.

like image 177
StevenMatthew - Microsoft Avatar answered Oct 22 '25 05:10

StevenMatthew - Microsoft