liveBook · Manning

Lifecycle policy

As explained in Microsoft Azure in Action

A lifecycle management policy is a set of rules that automatically performs data-management actions on storage objects based on conditions such as age or version age.

Storage costs add up when files stay in an expensive tier long after people stop using them. An Azure Storage lifecycle policy automates what happens next: it can move blobs between access tiers or delete them when they reach a specified age. The trade-off matters: cooler tiers can cost less to store but more to access. section 9.5.1

Move aging files

For a storage account holding books, a JSON rule targets block blobs and moves them to the cool tier more than 30 days after modification, then to archive after 90 days. It also deletes them after 365 days—but if those books must be kept, leave out the delete action. The rule is saved to a file and applied to the storage account with `az storage account management-policy create`. section 9.5.1

{
  "rules": [
    {
      "name": "TransitionHotToColdToArchive",
      "enabled": true,
      "type": "Lifecycle",
      "definition": {
        "actions": {
          "baseBlob": {
            "tierToCool": {
              "daysAfterModificationGreaterThan": 30
            },
            "tierToArchive": {
              "daysAfterModificationGreaterThan": 90
            },
            "delete": {
              "daysAfterModificationGreaterThan": 365
            }
          }
        },
        "filters": {
          "blobTypes": [
            "blockBlob"
          ]
        }
      }
    }
  ]
}

The JSON listing shows how one enabled rule combines blob-type filters with tier-transition and deletion actions. section 9.5.1

Version tracking creates another cleanup job: old versions can accumulate even when the current blobs are managed. A separate rule can delete blob versions more than 90 days after creation. Do not apply its JSON file as a replacement for the first policy: doing so overwrites that policy. Put both rules in one `rules` array, apply the combined file, then check the result with `az storage account management-policy show`. section 9.5.2

How Microsoft Azure in Action covers it

How deep it goes
Works through JSON rules, age conditions, CLI deployment, policy combination, and verification; does not detail the policy engine.
Examples
Uses a book-storage account with 30- and 90-day tier transitions, optional 365-day deletion, and 90-day version cleanup.
What it assumes
Assumes a storage account and introduces the JSON rule structure; version cleanup builds on enabled blob version tracking.
What you can do after
Apply it via Azure CLI using a combined JSON policy, then verify the storage account’s configured policy.
How it connects
Connects access tiers, block blobs, blob versioning, data retention, and storage costs.

Also explained in

Compare how 3 books explain lifecycle policy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microsoft Azure in Action. The section links point to the parts of the book it draws on.