Configure blob lifecycle management

Configure Azure Files and Azure Blob Storage

📘Microsoft Certified: Azure Administrator Associate (AZ-104)


1. What is Blob Lifecycle Management?

  • It is a policy-based system in Azure Blob Storage.
  • You define rules that automatically move blobs to different access tiers or delete them based on certain conditions.
  • Helps reduce storage costs and maintain compliance by cleaning up unused data automatically.

Key points for exam:

  • Works only for block blobs (page blobs are not supported for lifecycle management).
  • Can manage blobs in hot, cool, and archive tiers.
  • Uses filters and conditions such as blob type, last modified date, or blob index tags.

2. Storage Tiers and Lifecycle Actions

Azure Blob Storage has three main access tiers:

  1. Hot – For data accessed frequently. Fastest access, highest cost.
  2. Cool – For data accessed less often. Lower storage cost, slightly higher access cost.
  3. Archive – For rarely accessed data. Lowest storage cost, high retrieval cost.

Lifecycle management actions:

  • Move to Cool tier – Automatically move older data that is not accessed frequently.
  • Move to Archive tier – Move long-term or rarely accessed data.
  • Delete – Permanently delete data after a certain period.

Example in IT context:

  • Logs from servers: move them to Cool after 30 days, then to Archive after 90 days, delete after 1 year.

3. How Lifecycle Management Works

  1. Create a Policy
    • Policies are JSON-based, meaning you define them in JSON format or through Azure Portal.
  2. Define Rules
    • Each rule can target specific blob containers or blob types.
    • You can filter by prefix (like folder path) or blob index tags.
  3. Set Conditions and Actions
    • Conditions: Age of blob, last modified date, or blob tags.
    • Actions: Move to Cool, move to Archive, or delete.

Exam Tip:

  • You must know that lifecycle management is rule-based and JSON is often used, but you can also configure via Azure Portal or CLI.

4. Conditions You Can Use

  • Blob Age – Number of days since the blob was last modified.
  • Blob Type – Block blobs only.
  • Blob Index Tags – Key-value metadata tags to filter blobs.

Example JSON condition for exam:

{
  "if": {
    "daysAfterModificationGreaterThan": 90,
    "blobTypes": ["blockBlob"]
  },
  "then": {
    "tierToCool": {}
  }
}
  • This rule moves block blobs older than 90 days to the Cool tier.

5. Benefits of Blob Lifecycle Management

  1. Cost Optimization – Automatically moves data to lower-cost tiers.
  2. Automation – Reduces manual management of storage.
  3. Compliance – Can automatically delete data to meet regulatory requirements.
  4. Scalability – Works on thousands or millions of blobs efficiently.

6. How to Configure in Azure

Option 1: Azure Portal

  1. Go to Storage Account → Data management → Lifecycle management.
  2. Click + Add rule.
  3. Choose Scope – all blobs or specific containers.
  4. Set Filter – prefix or blob index tags.
  5. Set Actions – move to Cool, Archive, or Delete.
  6. Save the policy.

Option 2: Azure CLI

  • Example: Move blobs older than 30 days to Archive
az storage account management-policy create \
    --account-name <storage-account> \
    --policy '{
        "rules": [
            {
                "name": "moveToArchive",
                "enabled": true,
                "type": "Lifecycle",
                "definition": {
                    "actions": {
                        "baseBlob": {
                            "tierToArchive": {"daysAfterModificationGreaterThan": 30}
                        }
                    },
                    "filters": {
                        "blobTypes": ["blockBlob"]
                    }
                }
            }
        ]
    }'

7. Key Points for the Exam

  • Lifecycle management only applies to block blobs.
  • You can move data between Hot → Cool → Archive.
  • You can delete old blobs automatically.
  • You can filter by prefix, blob type, and tags.
  • Policies can be managed via Azure Portal, CLI, or PowerShell.
  • Important for cost optimization and compliance.

Exam Example Question

Q: You want to automatically move blobs older than 60 days to the Archive tier and delete blobs after 365 days. What Azure feature should you use?
A: Azure Blob Lifecycle Management.

Leave a Reply

Your email address will not be published. Required fields are marked *

Buy Me a Coffee