What is Lifecycle Management?
Azure Blob Storage Lifecycle Management is a rules engine that automatically manages blobs based on their age or last access time. You define a policy with one or more rules, and Azure applies those rules daily to blobs in your storage account.
Policy Structure
A lifecycle policy consists of one or more rules. Each rule has three parts:
1. Filters
Which blobs does this rule apply to? You can filter by:
- Blob type — blockBlob, appendBlob
- Prefix match — e.g., only blobs in
backups/prefix - Blob index tags — filter by custom metadata tags
2. Conditions
When should the action trigger? Based on:
- daysAfterModificationGreaterThan — days since blob was last modified
- daysAfterCreationGreaterThan — days since blob was created
- daysAfterLastAccessTimeGreaterThan — days since last access (requires access tracking enabled)
3. Actions
What happens when the condition is met?
- tierToCool — Move to Cool tier
- tierToCold — Move to Cold tier
- tierToArchive — Move to Archive tier
- delete — Permanently delete the blob
Common Lifecycle Patterns
Pattern 1 — Gradual Archive (Most Common)
Blobs are active initially, then used less over time, eventually archived or deleted:
- 0–30 days: Hot (active)
- 30–90 days: Cool (less frequent access)
- 90–365 days: Cold (rare access)
- 365+ days: Archive (compliance only)
- 2555+ days (7 years): Delete
Pattern 2 — Backup Retention
Keep daily backups for 30 days, then delete:
- 0–30 days: Cool
- 30+ days: Delete
Pattern 3 — Log File Management
Application logs: keep recent ones accessible, archive old ones:
- 0–7 days: Hot (being actively queried)
- 7–90 days: Cool
- 90+ days: Archive or Delete
Creating a Policy via Portal
- Go to your Storage Account in the Azure Portal
- In the left menu → Data management → Lifecycle management
- Click + Add a rule
- Give the rule a name
- Select Block blobs
- Set the filter (all blobs or by prefix)
- Configure the actions — e.g., "Move to cool after 30 days"
- Add more actions for further transitions
- Click Add
Creating a Policy via CLI
Lifecycle policies are defined in JSON format:
{
"rules": [
{
"name": "archiveOldBlobs",
"enabled": true,
"type": "Lifecycle",
"definition": {
"filters": {
"blobTypes": ["blockBlob"]
},
"actions": {
"baseBlob": {
"tierToCool": {
"daysAfterModificationGreaterThan": 30
},
"tierToCold": {
"daysAfterModificationGreaterThan": 90
},
"tierToArchive": {
"daysAfterModificationGreaterThan": 365
},
"delete": {
"daysAfterModificationGreaterThan": 2555
}
}
}
}
}
]
}
# Apply policy from JSON file
az storage account management-policy create \
--account-name mystorageaccount2026 \
--resource-group myResourceGroup \
--policy @lifecycle-policy.json
Filtering by Prefix
You can apply different lifecycle rules to different "folders" of blobs using prefix filters:
{
"rules": [
{
"name": "backupRetention",
"enabled": true,
"type": "Lifecycle",
"definition": {
"filters": {
"blobTypes": ["blockBlob"],
"prefixMatch": ["backups/"]
},
"actions": {
"baseBlob": {
"tierToCool": { "daysAfterModificationGreaterThan": 7 },
"delete": { "daysAfterModificationGreaterThan": 30 }
}
}
}
},
{
"name": "logArchive",
"enabled": true,
"type": "Lifecycle",
"definition": {
"filters": {
"blobTypes": ["blockBlob"],
"prefixMatch": ["logs/"]
},
"actions": {
"baseBlob": {
"tierToArchive": { "daysAfterModificationGreaterThan": 90 },
"delete": { "daysAfterModificationGreaterThan": 365 }
}
}
}
}
]
}
Handling Versions and Snapshots
If blob versioning is enabled, lifecycle policies can also manage old versions and snapshots separately from the current blob:
- version actions — apply to non-current versions
- snapshot actions — apply to blob snapshots
"actions": {
"baseBlob": {
"tierToArchive": { "daysAfterModificationGreaterThan": 365 }
},
"version": {
"tierToArchive": { "daysAfterCreationGreaterThan": 90 },
"delete": { "daysAfterCreationGreaterThan": 365 }
},
"snapshot": {
"delete": { "daysAfterCreationGreaterThan": 30 }
}
}
Real-World Examples
Media Company — Video Archive
A media company uploads new videos daily. Recent videos get lots of views, older ones rarely watched:
- 0–30 days: Hot (new release — high traffic)
- 30–180 days: Cool (catalog — occasional views)
- 180+ days: Cold (archive — very rare views)
- 3+ years: Archive (compliance archive)
Savings: Videos older than 6 months automatically stored at fraction of Hot tier cost.
Healthcare — Patient Records
Patient records must be kept for 7 years (regulatory requirement) but are rarely accessed after initial treatment:
- 0–1 year: Cool (recently treated, may need records)
- 1–7 years: Archive (compliance only)
- 7+ years: Delete (retention period expired)