Skip to content

Lifecycle Management Best Practices

Use these practices to keep lifecycle rules explainable, testable, and safe to operate.

This page's baseline at a glance — the recommended practices and the validation gate:

mermaid flowchart TD T["Lifecycle Management Best Practices"] P1["Translate policy intent into clear prefixes and tags"] T --> P1 P2["Move data through tiers with timing that reflects"] T --> P2 P3["Pair delete actions with soft delete"] T --> P3 P4["Review rule interactions whenever new datasets or prefixes"] T --> P4 V["Validation Checklist"] P1 --> V P2 --> V P3 --> V P4 --> V

Why This Matters

Lifecycle automation is powerful, but broad rules can delete or archive data faster than teams realize.

  • Prefix and tag design determine whether policy scope is understandable.
  • Policy execution is not immediate, so verification matters.
  • Destructive lifecycle actions should be paired with recovery controls where needed.
  • Translate policy intent into clear prefixes and tags.
  • Move data through tiers with timing that reflects business usage, not guesswork.
  • Pair delete actions with soft delete, versioning, or backup when recovery still matters.
  • Review rule interactions whenever new datasets or prefixes are added.
  • Validate policy outcomes with representative blobs after changes.

Example policy command

cat > lifecycle-policy.json <<'EOF'
{
  "rules": [
    {
      "enabled": true,
      "name": "archive-old-logs",
      "type": "Lifecycle",
      "definition": {
        "filters": {
          "blobTypes": ["blockBlob"],
          "prefixMatch": ["logs/"]
        },
        "actions": {
          "baseBlob": {
            "tierToCool": { "daysAfterModificationGreaterThan": 30 },
            "tierToArchive": { "daysAfterModificationGreaterThan": 180 },
            "delete": { "daysAfterModificationGreaterThan": 365 }
          }
        }
      }
    }
  ]
}
EOF

az storage account management-policy create \
    --resource-group $RG \
    --account-name $STORAGE_NAME \
    --policy @lifecycle-policy.json \
    --output json
Command Purpose
az storage account management-policy create Apply a lifecycle policy after generating the JSON inline in the runbook.
--resource-group Resource group that contains the storage account.
--account-name Name of the storage account the policy applies to.
--policy Path to the JSON policy document created in the previous lines.
--output Output format for the result.

Common Mistakes / Anti-Patterns

  • Rules nobody can explain: If operators cannot say which prefixes a rule affects, it is too broad.
  • Delete first, recover later: Recovery controls should be agreed before destructive automation is enabled.
  • Control-plane success only: A policy that saves successfully still needs blob-level validation later.

Validation Checklist

  • [ ] Prefixes or tags clearly define policy scope.
  • [ ] Tier timing reflects real business access patterns.
  • [ ] Delete rules are paired with recovery controls where appropriate.
  • [ ] Policy changes are reviewed for interaction with existing rules.
  • [ ] Sample blobs are validated after policy updates.

See Also

Sources