Back to Blog
2 min read

Azure Blob Storage Lifecycle Management

Blob Storage lifecycle policies automatically transition data to cheaper tiers or delete old data. Set it and forget it.

Storage Tiers

TierAccessCost (per GB)Use Case
HotFrequent$0.0184Active data
CoolInfrequent$0.01Backup, 30+ days
ArchiveRare$0.00099Compliance, years

Lifecycle Policy

{
  "rules": [
    {
      "name": "MoveToArchive",
      "enabled": true,
      "type": "Lifecycle",
      "definition": {
        "filters": {
          "blobTypes": ["blockBlob"],
          "prefixMatch": ["logs/", "backups/"]
        },
        "actions": {
          "baseBlob": {
            "tierToCool": {"daysAfterModificationGreaterThan": 30},
            "tierToArchive": {"daysAfterModificationGreaterThan": 90},
            "delete": {"daysAfterModificationGreaterThan": 365}
          }
        }
      }
    },
    {
      "name": "DeleteOldSnapshots",
      "enabled": true,
      "type": "Lifecycle",
      "definition": {
        "filters": {
          "blobTypes": ["blockBlob"]
        },
        "actions": {
          "snapshot": {
            "delete": {"daysAfterCreationGreaterThan": 90}
          }
        }
      }
    }
  ]
}

Applying the Policy

az storage account management-policy create \
    --account-name mystorageaccount \
    --resource-group myrg \
    --policy @lifecycle-policy.json

Cost Savings Example

1TB of logs per month:

  • All Hot: $184/month × 12 = $2,208/year
  • With lifecycle (30d hot, 60d cool, archive): ~$500/year

Savings: $1,700/year for 1TB

Considerations

  • Archive retrieval: Takes hours, costs extra
  • Cool minimum: 30-day minimum storage duration
  • Version considerations: Policies can apply to versions too

Set up lifecycle policies on day one. Future you will thank past you for the cost savings.

Michael John Peña

Michael John Peña

Senior Data Engineer based in Sydney. Writing about data, cloud, and technology.