Configure Azure Files and Azure Blob Storage
📘Microsoft Certified: Azure Administrator Associate (AZ-104)
1. Why Blob Versioning is Important
In IT environments, data in blob storage can change often—applications may update files, scripts, logs, or backups. Without versioning, any accidental change or deletion overwrites the original file, and it cannot be recovered.
Blob versioning solves this problem by:
- Automatically creating a new version of the blob whenever it is updated.
- Allowing you to restore an earlier version if needed.
- Ensuring data protection for critical business files, scripts, or configs.
Example in IT context:
A company stores configuration scripts in Azure Blob Storage. An administrator accidentally edits the wrong version of a script. With blob versioning, the previous version can be restored immediately without downtime.
2. How Blob Versioning Works
- When versioning is enabled on a storage account:
- Every time a blob is updated, Azure automatically creates a new version.
- Each version has a unique version ID.
- Older versions remain readable and restorable until explicitly deleted.
- Versioning is enabled at the storage account level, not at the individual blob level.
Key points for the exam:
| Feature | Detail |
|---|---|
| Scope | Storage account |
| Trigger | Any blob write or delete operation |
| Version ID | Unique identifier for each blob version |
| Restore | Can restore any previous version to be the current version |
| Deletion | Deleting a blob creates a soft-delete version, if soft delete is enabled |
3. Enabling Blob Versioning
You can enable versioning in Azure Portal, Azure CLI, or PowerShell.
Using Azure Portal:
- Navigate to the Storage Account.
- Go to Data management → Data protection.
- Turn Blob versioning to Enabled.
- Save changes.
Using Azure CLI:
az storage account blob-service-properties update \
--account-name <StorageAccountName> \
--resource-group <ResourceGroupName> \
--enable-versioning true
Using PowerShell:
Set-AzStorageServiceProperty -ServiceType Blob -EnableVersioning $true -StorageAccountName <StorageAccountName>
4. Managing Blob Versions
Once versioning is enabled, you can manage blob versions:
- List blob versions:
az storage blob list \
--container-name <container> \
--account-name <storageaccount> \
--include v
- Read a specific version: Use the version ID in your API or Azure Portal.
- Restore a previous version:
- You can copy the older version back to overwrite the current blob.
- Or use the Azure Portal’s “Restore previous version” feature.
- Delete a version: Deleting a blob version does not affect other versions.
5. Important Exam Notes
- Blob versioning and soft delete are different but complementary.
- Versioning: Protects against overwrites by keeping older versions.
- Soft delete: Protects against accidental deletes by keeping deleted blobs for a retention period.
- Costs:
Each version is treated as a separate blob for storage billing. Plan storage accordingly. - Version IDs:
- Unique to each version.
- Required when restoring or deleting a specific version.
- Use cases for IT environments:
- Keeping previous versions of scripts, configs, or code.
- Auditing changes in stored files.
- Recovery of accidentally overwritten business documents or logs.
6. Exam Scenario Questions
The exam may ask scenarios like:
- Enable blob versioning for data protection:
- Correct answer: Enable versioning in the storage account settings.
- Restore an accidentally overwritten file:
- Correct answer: Find the previous version by version ID and restore it.
- Difference between versioning and soft delete:
- Versioning: Protects overwrites.
- Soft delete: Protects deletions.
✅ Summary (For Quick Revision)
- Blob versioning keeps previous versions of blobs automatically.
- Enabled at storage account level.
- Protects against accidental overwrites.
- Works with soft delete for full data protection.
- Versioning can be enabled via portal, CLI, or PowerShell.
- Restore older versions using version ID.
- Every version is billed separately.
