Data is everything in the current world, and no one wants to lose it. However, we need to follow the right strategies and best practices to know what is happening with data and how to recover if something wrong happens to data.
Azure Storage Service provides many data protection options that are available under Recovery and Tracking categories.
Recovery has the below options —
- Turn on point-in-time restore for containers
- Turn on soft delete for blobs
- Turn on soft delete for containers (this feature is in preview)
Tracking has the below options —
- Turn on versioning for blobs
- Turn on blob change feed
So, let’s go through each with a brief introduction —
Point-in-time helps to recover block blob to a previous state if deleted accidentally or corrupted due to an application operation. This recovery option is only supported by general-purpose v2 storage accounts. When we enable Point-in-time, then versioning for blobs and blob change feed will get enabled automatically.
The Point-in-time feature has a retention period and the default value is 6. You can restore block blobs from the current state to a state at an earlier point in time. The restore process is a transactional operation which means it either succeeds completely in restoring all changes, or fails. This is a great feature, but have some limitations as mentioned below —
- This feature is only limited to block blob and only general purpose V2 storage account is supported.
- Point-in-time restore cannot be applied on deleted containers which means cannot be restored
- Snapshots are not generated or deleted during the restore operation.
- Restoring block blobs in the archive tire is not supported.
Soft Delete for Blobs
When this feature is enabled, then accidentally deleted blobs may be recovered within the retention period. This feature is available for block blobs, append blobs or page blobs. Soft deleted blobs are deleted permanently after the specified retention period. By default, soft deleted blobs are not visible inside the containers, we have to enable the Show deleted blobs from the blob listing screen.
This feature is available for the below configurations —
- Standard and premium account types are supported
- General-purpose v2, general-purpose v1, and Blob storage accounts are supported.
- Hot, cool, and archive tires are supported
- Available for unmanaged disks, which are page blobs, but is not available for managed disks.
This feature can be enabled at any time with a retention period either while creating a new storage account or to an existing storage account.
The soft delete retention period can be changed at any time. An updated retention period applies only to newly deleted data. Previously deleted data expires based on the retention period that was configured when that data was deleted.
Soft Delete for Containers
Now, This is a general available feature in the storage account. So far, we talked about blob and how to recover, but suppose if accidentally storage account deleted, then what to do? This feature can be used to recover containers.
Container soft delete is available in General-purpose v2 storage, block blob storage account, blob storage accounts.
The default retention period for the soft delete container is 7 days but can be configured between 1 to 365 days. After the retention period has expired, containers are permanently deleted from the storage account and cannot be recovered.
Blob versioning helps to maintain the last modified version of an object (Files, Images or Videos, etc), if the same object is updated by any operation. If blob versioning is enabled, then any available previous copy can be restored. We should use blob versioning to maintain previous versions to enable another layer of data protection.
Blob versioning feature is available for general-purpose V2, block blob, and Blob storage accounts. If this feature is enabled, then it applies to all blobs in the storage account. The storage account automatically creates another version when there are any changes in any existing blobs or uploading the same file again and again.
This feature only enables to protect data inside blob container, but if you the delete storage account or container then, data cannot be recover.
The blob versioning article is here.
Blob Change Feed
The change feed option logs all the changes performed (create, update, and delete event) to the blob and its metadata in the special container $blobchangefeed. The change feed provides a read-only, ordered, guaranteed, durable and immutable log for the changes.
The container $blobchangefeed stores details in folders idx, log, and meta folder. Any client application can consume logs by reading asynchronously, incrementally or in-full. The change feed logs are stored in the append blob in the storage account and time to live can be managed with a retention period.
if you have a requirement to handle a large number of blob changes, then change feed is a good candidate to be enabled.
So, we have seen what options are available to track and recover the data within Azure Storage Account.
If you have any suggestions/feedback, please put them in the comment box.
Happy Learning 🙂