Last updated: May 2026
Azure Storage Intermediate AZ-104 ⏱ 11 min read

Blob Lifecycle Management

You know that moving blobs from Hot to Cool to Archive saves money. But doing this manually for thousands or millions of blobs is impossible. Azure Blob Lifecycle Management lets you define rules that automatically transition blobs between tiers — or delete them — based on age or last-accessed time. Set it once, save money forever.

What you'll learn What lifecycle management is · Policy structure — rules, filters, actions · Common lifecycle patterns · Creating policies via portal and CLI · Filtering by blob prefix · Handling blob versions and snapshots · Real-world cost optimisation examples

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.

ℹ️
Why It Matters Manually managing tier transitions for large storage accounts is impossible. A single backup storage account might have millions of blobs. Lifecycle policies automate the entire process — blobs automatically move to cheaper tiers as they age, and delete themselves when they're no longer needed.

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

  1. Go to your Storage Account in the Azure Portal
  2. In the left menu → Data managementLifecycle management
  3. Click + Add a rule
  4. Give the rule a name
  5. Select Block blobs
  6. Set the filter (all blobs or by prefix)
  7. Configure the actions — e.g., "Move to cool after 30 days"
  8. Add more actions for further transitions
  9. Click Add

Creating a Policy via CLI

Lifecycle policies are defined in JSON format:

JSON lifecycle-policy.json — Gradual archive pattern
{
  "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
            }
          }
        }
      }
    }
  ]
}
Azure CLI Apply the lifecycle policy
# 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:

JSON Separate rules for backups and logs
{
  "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
JSON Manage blob versions lifecycle
"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)
💡
AZ-104 Exam Tip Know that lifecycle policies automate tier transitions and deletions based on blob age. Know that rules can filter by blob type and prefix. Know that policies are applied daily by Azure. Know that you can manage blob versions and snapshots separately from base blobs.
📝 Practice Questions
Click an option to check your answer. AZ-104 style questions.
Q1. What is the primary purpose of Azure Blob Storage Lifecycle Management?
A To improve blob storage performance
B To automatically move blobs between tiers or delete them based on age to reduce costs
C To replicate blobs to a secondary region automatically
D To create automatic versions of blobs when they are modified
Q2. How often does Azure evaluate and apply lifecycle management policies?
A In real-time as blobs are created or modified
B Daily
C Weekly
D Only when manually triggered
Q3. A company wants to apply a lifecycle policy only to blobs in the "backups/" virtual folder. How do they achieve this?
A Create a separate container named "backups" and apply the policy to that container
B Use a prefix filter in the lifecycle rule — set prefixMatch to "backups/"
C Tag all backups blobs with a "backups" tag and filter by tag
D Apply the lifecycle policy only to the storage account in the backups resource group
Q4. Which action in a lifecycle policy permanently removes blobs?
A tierToArchive
B tierToCool
C delete
D remove
Q5. A lifecycle policy is configured to move blobs to Cool after 30 days and delete them after 90 days. A blob was last modified 45 days ago. What tier is it in?
A Hot
B Cool
C Archive
D Deleted
Comments
Disclaimer: RedKite Cloud is an independent educational resource and is not affiliated with, endorsed by, or officially connected to Microsoft Corporation. All product names, logos, and trademarks are property of their respective owners. Content is written independently for educational purposes only.