Microsoft has recently introduced a feature that will allow Azure storage blob data to be recovered after being accidentally deleted. The feature is known as "soft delete," and it is currently in public preview. In this article, I will explain what soft delete is and how it works.
What are Azure Storage Blobs?
Before I delve into a discussion of soft delete, I wanted to take just a moment to discuss Azure Storage Blobs for the benefit of anyone who might not be familiar with the technology. The word "blob" is essentially a mashup of several other words. It is short for binary large object. Hence, Azure Storage Blob is the name that Microsoft has given to its object storage solution. Architecturally, Azure Blob Storage is similar to Amazon S3 and other competing cloud object storage services.
Object storage is designed to accommodate massive amounts of unstructured data (file data), but does so in a way that is significantly different from a typical file storage solution. Object storage uses a flat file system, and data is typically accessed through REST calls using the HTTP or HTTPS protocol.
How Soft Delete Works
On the most basic level, you can think of soft delete as being similar to the Windows recycle bin. When you delete a file from the Windows file system, the file is not permanently deleted (at least not in most cases), but rather is moved to the recycle bin. That way, the file can be recovered if it is later determined that the file is needed. The soft delete feature in Microsoft Azure does essentially the same thing for blob storage. When data is deleted or overwritten, the data is not actually gone. Instead, the data is soft deleted, thereby making it recoverable if necessary.
The Soft Delete feature accomplishes this through the use of snapshots. Those who have been working with Windows Server for a long time may recall that early versions of Hyper-V included a snapshot feature. Microsoft later changed the name of Hyper-V snapshots to "checkpoints." In the case of Azure storage blobs, however, Microsoft is using the word snapshots. This nomenclature is a reference to architectural differences in these features: Hyper-V checkpoints are based on the use of differencing disks, while Azure storage blobs snapshots are based on changed Block tracking.
There are two additional things that are important to know about soft delete.
First, soft delete is a storage blob level feature. This means that it is able to protect objects residing within a storage blob. However, it can't protect the blob itself. If an administrator were to accidentally delete an entire storage blob (or the container that holds the blob), then the blob contents would be lost, regardless of whether soft delete was enabled. Similarly, the soft delete feature does nothing to protect against the deletion of an entire Azure account. If an Azure account is deleted, then the objects within that account are also deleted (over time), including storage blobs. Second, soft delete is not enabled by default. This holds true regardless of whether you are working with a new or existing storage account. You can, however, turn soft delete on or off as needed.
Enabling Soft Delete
Microsoft makes it really easy to enable the soft delete feature: Just log into the Azure portal, and then click on All Services. When the list of services appears, go to the Storage section and click on the Storage Accounts link. This will cause the Storage Accounts page to be displayed. Now, click on your storage account (or click Add to create a new one).
With your storage account selected, scroll through the menu until you locate the BLOB Service section. Now, click on the Soft Delete option within this section. You can enable soft delete by clicking on the Enable button, as shown in Figure 1.
It is worth noting that once Soft Delete is enabled, you can set a retention policy for deleted or overwritten data. The default retention period is seven days, but you can retain data for up to a year. In any case, you will have to click the Save button when you are done, to complete the process of enabling Soft Delete.