Overview and What You Will Learn
In this lab, you will upload blobs to a Storage Account, move a blob between access tiers manually, then configure a Lifecycle Management policy that automates that same movement based on age - so aging data stops costing Hot-tier prices without anyone having to remember to change it.
Why This Matters in Production
At a media platform like Hotstar, months of old video thumbnails sitting in the Hot access tier instead of Cool or Archive can quietly cost thousands of dollars a month for data nobody has requested in weeks. The fix is not deleting the data - it is simply storing it in a tier priced for how often it's actually accessed.
Core Principles
Azure Blob Storage offers three access tiers, and the right choice depends entirely on how often a specific blob is expected to be read, not on how important the data is.
+------------------------------------------+| Hot tier || Highest storage cost, lowest retrieval cost|| Best for: data read frequently |+------------------------------------------+| Cool tier || Lower storage cost, higher retrieval cost || Best for: data kept 30+ days, rarely read |+------------------------------------------+| Archive tier || Lowest storage cost, highest retrieval cost|| Best for: data kept 180+ days, plus a || retrieval delay before it's readable again |+------------------------------------------+Moving a blob to a colder tier is cheap and instant. Moving it back to a warmer tier, especially out of Archive, involves a retrieval cost and, for Archive specifically, a delay of several hours before the data becomes readable again - this asymmetry is the main reason to choose the correct tier upfront rather than treating tier assignment as easily reversible.
Detailed Step-by-Step Practical Lab
- Create a Resource Group and a Storage Account:
az group create --name rg-tiers-lab-mumbai --location centralindia az storage account create \ --name sttierslabrahul \ --resource-group rg-tiers-lab-mumbai \ --location centralindia \ --sku Standard_LRS- Create a container and upload a test blob, which defaults to the Hot tier:
az storage container create \ --name old-reports \ --account-name sttierslabrahul echo "quarterly report content" > report-q1.txt az storage blob upload \ --account-name sttierslabrahul \ --container-name old-reports \ --name report-q1.txt \ --file report-q1.txt- Manually move that blob to the Cool tier to see how a single blob's tier is changed directly:
az storage blob set-tier \ --account-name sttierslabrahul \ --container-name old-reports \ --name report-q1.txt \ --tier Cool- Confirm the tier change was applied:
az storage blob show \ --account-name sttierslabrahul \ --container-name old-reports \ --name report-q1.txt \ --query "properties.blobTier" --output tsv- Create a Lifecycle Management policy file that automates this transition based on blob age, rather than requiring a manual command every time:
cat > lifecycle-policy.json << 'POLICYEOF'rules: - name: moveOldReportsToCoolThenArchive enabled: true type: Lifecycle definition: filters: blobTypes: - blockBlob prefixMatch: - old-reports/ actions: baseBlob: tierToCool: daysAfterModificationGreaterThan: 30 tierToArchive: daysAfterModificationGreaterThan: 180POLICYEOFNoteThis policy file is shown here as YAML for readability in this guide, but the actual file Azure expects is JSON - the structure and meaning are identical either way, only the exact syntax on disk differs.
- Apply the Lifecycle Management policy to the storage account:
az storage account management-policy create \ --account-name sttierslabrahul \ --resource-group rg-tiers-lab-mumbai \ --policy @lifecycle-policy.json- Confirm the policy was applied correctly:
az storage account management-policy show \ --account-name sttierslabrahul \ --resource-group rg-tiers-lab-mumbai- Clean up:
az group delete --name rg-tiers-lab-mumbai --yes --no-waitProduction Best Practices & Common Pitfalls
Common MistakeLeaving all blobs in the Hot tier indefinitely because nobody revisited the setting after the initial upload. A Lifecycle Management policy set once continues working automatically, moving data to Cool then Archive as it ages, without requiring anyone to remember to do it manually.
TipBefore moving anything to Archive, confirm your team's actual tolerance for retrieval delay. Archive retrieval is not instant - if the data might genuinely be needed on short notice, Cool is the safer floor even at a higher storage cost than Archive.
- Match the tier to the real access pattern, not to how "important" the data feels. A critical compliance backup that is never actually read except during an audit is still a strong Archive candidate - importance and access frequency are different questions.
- Retrieving data from Cool or Archive costs more per read than Hot. A tier chosen purely to minimize storage cost, without checking expected read frequency, can end up costing more overall once retrieval charges are included.
Quick Reference & Troubleshooting Commands
| Command | Description |
|---|---|
az storage blob set-tier |
Manually change a single blob's access tier |
az storage blob show --query "properties.blobTier" |
Check a blob's current tier |
az storage account management-policy create |
Apply a Lifecycle Management policy |
az storage account management-policy show |
View the current Lifecycle Management policy |