Overview and What You Will Learn
An Azure Blob Storage access tier sets how a blob is priced and stored: colder tiers cost less to store but more to read, and the coldest tier keeps data offline. Azure offers four tiers, Hot, Cool, Cold and Archive, and you choose them by how often a blob is read, not by how important the data is. In this lab, you will move a blob through the tiers by hand, see that an archived blob cannot be read until it is rehydrated, and then write a lifecycle management policy that does the moving automatically as data ages.
- Telling Hot, Cool, Cold and Archive apart and what each costs you
- Changing a blob's tier with the CLI
- Seeing what happens when you read an archived blob
- Rehydrating an archived blob
- Writing a lifecycle management policy that tiers data by age
Why This Matters in Production
A media platform like Spotify accumulates years of generated images and reports that were read often in the first few weeks and almost never afterwards. Left in the Hot tier, that data quietly costs the Hot price every month. The fix is not deleting it. It is storing it in the tier priced for how often it is actually read, and letting a policy do the moving so nobody has to remember.
Core Principles
Each step colder lowers the price per gigabyte stored and raises the price of reading and of early deletion. The right choice depends on how long you will keep the data and how often you will read it.
| Tier | Minimum retention | Reading the data |
|---|---|---|
| Hot | None | Online, lowest access cost |
| Cool | 30 days | Online, higher access cost |
| Cold | 90 days | Online, higher again |
| Archive | 180 days | Offline, must be rehydrated first |
Deleting or moving a blob out of a tier before its minimum retention period ends is charged as an early deletion fee for the remaining days.
new data] -->|After 30 days| C[Cool] C -->|After 90 days| CO[Cold] CO -->|After 180 days| A[(Archive
offline)] A -.->|Rehydrate, hours| H classDef hot fill:#EF4444,color:#FFFFFF classDef cool fill:#326CE5,color:#FFFFFF classDef cold fill:#8B5CF6,color:#FFFFFF classDef arch fill:#475569,color:#FFFFFF class H hot class C cool class CO cold class A arch
Moving a blob to a colder tier is quick, but it is not free, since the change is billed as an operation and early deletion rules apply. Moving back out of Archive is slower still. A blob in Archive cannot be read at all, and rehydrating it to Hot, Cool or Cold takes hours at standard priority. Because of this asymmetry, it is worth choosing the tier deliberately instead of treating it as easily reversible.
Tiers apply to block blobs in general-purpose v2 and Blob Storage accounts. An account also has a default access tier, Hot or Cool, which blobs inherit unless they have an explicit tier of their own.
Detailed Step-by-Step Practical Lab
Set the variables used throughout the lab. Storage account names are globally unique, lowercase and 3 to 24 characters.
export RG=rg-tiers-lab-indiaexport LOCATION=centralindiaexport SA_NAME=sttiers$RANDOM- Create the resource group and a general-purpose v2 storage account whose default tier is Hot:
az group create --name $RG --location $LOCATION az storage account create \ --name $SA_NAME \ --resource-group $RG \ --location $LOCATION \ --kind StorageV2 \ --sku Standard_LRS \ --access-tier Hot- Give yourself permission to work with blob data. The commands below use your Entra ID login instead of account keys:
export SA_ID=$(az storage account show --name $SA_NAME --resource-group $RG --query id --output tsv)export MY_ID=$(az ad signed-in-user show --query id --output tsv) az role assignment create \ --assignee-object-id $MY_ID \ --assignee-principal-type User \ --role "Storage Blob Data Contributor" \ --scope $SA_IDRememberRole assignments can take a few minutes to take effect. If a blob command returns an authorization error right after this step, wait two or three minutes and retry.
- Create a container and upload a test blob, then confirm it starts in Hot:
az storage container create \ --name old-reports \ --account-name $SA_NAME \ --auth-mode login echo "quarterly report content" > report-q1.txt az storage blob upload \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --file report-q1.txt \ --auth-mode login az storage blob show \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --query "properties.blobTier" --output tsv \ --auth-mode login- Move the blob through Cool and Cold. The blob stays readable in both:
for TIER in Cool Cold; do az storage blob set-tier \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --tier $TIER \ --auth-mode login az storage blob show \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --query "properties.blobTier" --output tsv \ --auth-mode logindone- Move the blob to Archive, then try to read it. The download fails because archived data is offline:
az storage blob set-tier \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --tier Archive \ --auth-mode login az storage blob download \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --file downloaded.txt \ --auth-mode loginThe error says the operation is not permitted on an archived blob. This is the delay and cost trade-off you accept for the lowest storage price.
- Start rehydration back to Hot and watch its status. At standard priority this can take many hours, so you do not need to wait for it to finish:
az storage blob set-tier \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --tier Hot \ --rehydrate-priority Standard \ --auth-mode login az storage blob show \ --account-name $SA_NAME \ --container-name old-reports \ --name report-q1.txt \ --query "{tier:properties.blobTier, rehydration:properties.rehydrationStatus}" \ --output table \ --auth-mode loginThe tier still shows Archive while the rehydration status shows it is pending a move to Hot.
- Create a lifecycle management policy. The file must be JSON, and the rule matches blockBlobs under the
old-reports/prefix. The day counts must increase from one action to the next:
cat > lifecycle-policy.json << 'EOF'{ "rules": [ { "name": "tier-old-reports", "enabled": true, "type": "Lifecycle", "definition": { "filters": { "blobTypes": ["blockBlob"], "prefixMatch": ["old-reports/"] }, "actions": { "baseBlob": { "tierToCool": { "daysAfterModificationGreaterThan": 30 }, "tierToCold": { "daysAfterModificationGreaterThan": 90 }, "tierToArchive": { "daysAfterModificationGreaterThan": 180 } } } } } ]}EOF- Apply the policy and read it back:
az storage account management-policy create \ --account-name $SA_NAME \ --resource-group $RG \ --policy @lifecycle-policy.json az storage account management-policy show \ --account-name $SA_NAME \ --resource-group $RGLifecycle policies run on a schedule, roughly once a day, and the first run can take up to 24 hours after you create or change a policy. You verify the configuration now and the effect later.
- Clean up. Deleting a blob that sits in Archive before 180 days can incur a small early deletion charge, which is negligible for this lab:
az group delete --name $RG --yes --no-waitProduction Best Practices & Common Pitfalls
Common MistakeLeaving everything in the Hot tier forever because nobody revisited the setting after the first upload. A lifecycle policy set once keeps working, moving data to colder tiers as it ages, with no one having to remember.
TipBefore using Archive, confirm how long your team can wait for data. If it might be needed on short notice, Cold or Cool is the safer floor, even though the storage price is higher.
- Match the tier to the access pattern, not to how important the data feels. A compliance backup that is read only during an audit is a strong Archive candidate, because importance and read frequency are separate questions.
- Do the arithmetic before moving data. Colder tiers charge more per read and have minimum retention, so a tier picked only to lower storage cost can cost more overall if the data is read often or deleted early.
- Base rules on last access when that fits. A rule using
daysAfterLastAccessTimeGreaterThanmoves data by when it was last read instead of last modified, but it needs last access tracking enabled on the account. - Add a delete action for data with a known end of life. Lifecycle rules can also delete blobs and old versions or snapshots, which removes a cost entirely.
- Scope rules with prefixes and tags. Filtering by container prefix or blob index tags stops a broad rule from moving data you still read often.
- Know the limits. Tiering needs a general-purpose v2 or Blob Storage account, and premium block blob accounts do not support access tiers.
Quick Reference & Troubleshooting Commands
| Command | Description |
|---|---|
az storage blob set-tier --tier Cool |
Change a single blob's access tier |
az storage blob set-tier --tier Hot --rehydrate-priority Standard |
Start rehydration from Archive |
az storage blob show --query properties.blobTier |
Check a blob's current tier |
az storage account management-policy create --policy @file.json |
Apply a lifecycle management policy |
az storage account management-policy show |
View the current policy |
az storage account update --access-tier Cool |
Change the account default tier |
| Problem | Cause | Fix |
|---|---|---|
| Download fails with an archived blob error | Blob is in Archive and offline | Rehydrate it to Hot, Cool or Cold and wait |
| Policy is rejected | File is not valid JSON, or day counts do not increase | Fix the JSON and order the tiers by increasing days |
| Blobs did not move after applying the policy | The scheduled run has not happened yet | Wait up to 24 hours, then check again |
| Authorization error on blob commands | Missing data-plane role, or not yet propagated | Assign Storage Blob Data Contributor and wait |
| Unexpected early deletion charge | Blob moved or deleted before its minimum retention | Check retention periods before changing tiers |