Open In App

Microsoft Azure – Using Blob Versioning

Improve
Improve
Like Article
Like
Save
Share
Report

In the given article we will learn how to use blob versioning in the Azure Portal. So, users have applications that perform read and write transactions against blobs in their storage account. And, sometimes it’s common for an application to mistakenly modify or delete one of the blobs in the storage account, and users need a way to recover from this in a simple and seamless way which blob versioning allows to do.

What is  Blob Versioning?

Blob versioning allows you to restore an earlier version of your blog in case an application or you mistakenly modify or delete it. A version keeps the state of a blob at any given point in time. So when you modify a blob, what Azure Storage will do is automatically create a new version that captures the state of that blob right before it was modified, so that the newly modified blob becomes the new current version, and that original blob becomes a previous version. Even if you delete that blob, its previous version still persists, so you can use those previous versions to recover the blob at a later point in time.

Implementation:

First, let’s walk through how you enable blob versioning. Scroll over to the data protection tab underneath blob service and click enable versioning. You can also enable versioning when you’re creating your storage account. And when you enable blob versioning, Azure Storage will automatically create and maintain versions on your behalf.

Suppose you have an application that stores and manages your images for you, and it accidentally delete an image that you did not want to be deleted.  With versioning, you can revive the deleted image.

 First, click show deleted blobs. You can see here that Azure Storage has recognized this blob as deleted and marked it as so. 

Then you go over to the Versions tab and then you see that Azure Storage has created a version and captured the previous state of the blob before it was deleted. So to recover it, click on it and make it the current version. 

 And now if you go back to the blobs blade here, you can see that it’s now active and ready to use again.

The blob only had one previous version, but it’s possible that a blob could have hundreds of previous versions. Azure Storage will automatically create a version for you anytime the blob is modified. Suppose you were editing a photo and you were making edits to it. For every edit that you make, Azure Storage will create a version for you to capture the state before it was modified. And so, suppose you made edits and now want the original state of your photo back. With Azure Storage blob versioning, you can do that.

Here, you have to do is find the previous version that captured the state of your original blob and uses that and make it the current version.


Last Updated : 03 Apr, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads