Move old files to cool or archive automatically

Azure Portal, Hands On10 minutesFree tierSteps checked 23 October 2026By Cloud Hands On

In this task you'll move old blobs to cheaper tiers automatically.

Data that nobody reads any more still costs money to keep. Lifecycle management rules move blobs to cheaper tiers as they age, and can delete them at the end, all without anyone lifting a finger.

The tiers go from Hot (cheap to read, dearer to keep) through Cool and Cold to Archive (very cheap to keep, but it takes hours to get a file back).

Example. Ironbridge Payments keeps nightly reports Hot for 30 days, Cool until 90 days, then Archive, and deletes them after seven years to match its record-keeping policy.

Before you start

You need: Storage Account Contributor or Contributor. Time: 10 minutes.

Where to look

  1. Storage accounts
  2. your account
  3. Lifecycle management
  4. + Add a rule

Steps

  1. Open your storage account and select Lifecycle management.
  2. Select + Add a rule and name it age-out-docs.
  3. Choose to limit the rule with filters, keep Block blobs and Base blobs, and select Next.
  4. Set the first condition: if base blobs were last modified more than 30 days ago, then move to cool storage.
  5. Select Add conditions and add: more than 180 days, then move to archive storage. Then add: more than 365 days, then delete the blob.
  6. Select Next. Under the filter, enter a prefix of docs/ so the rule only touches the docs container, then Add.Rules run about once a day, so nothing happens straight away.

Tip. Lifecycle management is in the left menu under Data management.

Commands

# Write the rule to a file, then apply it
cat > policy.json <<'END'
{ "rules": [ { "name": "age-out-docs", "enabled": true, "type": "Lifecycle",
  "definition": {
    "filters": { "blobTypes": ["blockBlob"], "prefixMatch": ["docs/"] },
    "actions": { "baseBlob": {
      "tierToCool": { "daysAfterModificationGreaterThan": 30 },
      "tierToArchive": { "daysAfterModificationGreaterThan": 180 },
      "delete": { "daysAfterModificationGreaterThan": 365 } } } } } ] }
END

az storage account management-policy create --account-name <account> \
  --resource-group rg-portal-practice --policy @policy.json

Watch out for

Cost
Rules are free, and moving data to cooler tiers usually saves money. But each move is a write, early deletion charges apply, and reading from cool or archive costs more.
Security
A delete action really deletes. Test rules with a prefix filter on a practice container before applying them to important data.
Common mistakes
Archiving data that someone might need quickly: getting it back takes hours. Forgetting the minimum time in each tier and paying early deletion charges.

Clean up

  1. Lifecycle management
  2. age-out-docs
  3. Delete

Tick the rule and select Delete, or remove everything with the resource group at the end of this section.

Words to know

Archive tier
The cheapest tier. Files must be rehydrated, which takes hours, before they can be read.
Rehydrate
Move a blob out of Archive so it can be read again.
Early deletion charge
A fee for moving or deleting a blob before it's spent the minimum time in a tier: 30 days for Cool, 90 for Cold and 180 for Archive.

Tick off each step and track your progress in the guide.

Open this task in Azure Portal, Hands On

Keep going