Blob Lifecycle, Versioning & Soft Delete
Automate blob management with lifecycle policies, protect against accidental deletion with soft delete, and track changes with versioning and snapshots. These features turn blob storage from a simple file dump into a managed data platform.
Blob lifecycle management
Lifecycle policies are like automatic filing rules β βafter 30 days, move to the archive; after 365 days, delete.β
Without lifecycle policies, youβd manually move old blobs to cheaper tiers or delete expired data. With a lifecycle policy, Azure does it automatically based on rules you define: age, last access time, or creation date.
Example lifecycle policy rules
| Rule | Action | Trigger |
|---|---|---|
| Move to Cool after 30 days | tierToCool | 30 days after last modified |
| Move to Archive after 90 days | tierToArchive | 90 days after last modified |
| Delete after 365 days | delete | 365 days after creation |
| Delete old snapshots | delete snapshot | 90 days after snapshot creation |
| Delete previous versions | delete version | 60 days after version creation |
Real-world: TechCorp's lifecycle policy
TechCorp Solutions has a lifecycle policy on their backup container:
- Blobs move from Hot β Cool after 30 days
- Cool β Cold after 90 days
- Cold β Archive after 180 days
- Delete after 2,555 days (7 years β legal retention)
- Previous versions deleted after 60 days
- Snapshots deleted after 90 days
This runs automatically every day. Alex doesnβt touch it β the data just flows through the tiers.
Soft delete
Soft delete protects against accidental deletion by retaining deleted blobs and containers for a configurable period.
Two types:
- Blob soft delete β retains deleted blobs and overwritten blobs for N days (1-365)
- Container soft delete β retains deleted containers for N days (1-365)
During the retention period, you can restore (undelete) the blob or container. After the retention period, the data is permanently removed.
Important: Soft delete does NOT protect against storage account deletion. If the entire storage account is deleted, soft-deleted blobs go with it.
Snapshots and versioning
Snapshots are read-only copies of a blob at a specific point in time. You manually create them, and they capture the entire blob state.
Versioning automatically creates a new version every time a blob is modified or overwritten. Previous versions are retained and can be accessed or restored.
| Feature | Snapshots | Versioning |
|---|---|---|
| Created | Manually (API call or portal) | Automatically on every write/overwrite |
| Read access | Yes β read-only copy | Yes β previous versions are readable |
| Use case | Point-in-time backup before changes | Continuous change tracking and protection |
| Storage cost | Charged for unique data only | Charged for unique data in each version |
| Restore | Copy snapshot over current blob | Promote a previous version to current |
Exam tip: Versioning + soft delete = maximum protection
The exam often tests the combination: enable blob versioning (automatic versions on every write) + blob soft delete (retain deleted blobs). Together, they protect against both accidental overwrites and accidental deletions. This is Microsoftβs recommended configuration for important data.
Object replication
Object replication asynchronously copies blobs from a source container to a destination container in a different storage account (same or different region).
Use cases:
- Latency reduction β replicate data closer to users in different regions
- Compute efficiency β process data in a different region without cross-region transfer
- Data distribution β replicate data to partners or branch offices
Requirements:
- Blob versioning must be enabled on both source and destination accounts
- Change feed must be enabled on both accounts
- The storage accounts can be in different regions
- Replication is asynchronous (not instant)
- Only block blobs are supported
Knowledge check
TechCorp Solutions wants to automatically move blobs to the Cool tier after 30 days and delete them after 1 year. What should Alex configure?
CloudFirst Labs accidentally deleted an important blob 3 days ago. Blob soft delete is enabled with a 7-day retention period. What can they do?
π¬ Video coming soon