Azure Blob Versioning and AzCopy

This post has been republished via RSS; it originally appeared at: ITOps Talk Blog articles.

Azure Blob Versioning when enabled is a feature that will automatically maintain previous versions of an object.  This allows you to restore an earlier version to recover your data if it was modified or deleted by mistake.   Which is a great feature to be able to have access to for organisations or even for home use.  Being able to quickly recover a previous version of a file without having to engage your whole backup/recovery process/tool will save a lot of pain and time.


You can enable blob versioning when you create an Azure Storage account in the portal or via an ARM template.


Azure PortalAzure Portal
Azure PortalAzure Portal


I have an Azure Storage Account with a Blob Container and some files stores within it, just some simple text files.  I have versioning turned on that storage account.


You can see with my music.txt file that I have the ability to see the different saved versions of that file.  Each version of the file is given a version ID to help you identify it.


For each version of the file I have a lot of options, I can download it, make it the current version (ultimately restoring it), delete it, generate a shared access signature (SAS) for that blob or even change the access tier that that version is stored in.

Azure PortalAzure Portal


Now you don’t just have to use the Azure Portal to interact with the versions of the files.  AzCopy supports interacting with them as well.


If I launch AzCopy and issue the AzCopy Copy command, which will copy files from one location to another.  In this case I want to copy the different versions of my “music.txt” from Azure down to my local machine.


The command starts off with the copy instruction and the source and destination locations, then I add on the switch that will allow me to download the file versions:


Azcopy copy “C:\users\salean\downloads\azurestorage” –list-of-versions=”versions.txt”


Copy code snippet


For the list of versions switch to work I need to pass in a file listing the version IDs of all the versions that I want to download. Each version ID needs to be placed in a separate line.

And when I run the command AzCopy will download the relevant files for me.


Windows Terminal and commandsWindows Terminal and commands

REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.