Blob Storage lifecycle management policy not deleting expired blobs despite correct configuration

We’ve configured a lifecycle management policy on our Azure Blob Storage account to automatically delete blobs older than 90 days, but we’re seeing rising storage costs and blobs that should have been deleted are still present.

Here’s our policy JSON:

{
  "rules": [{
    "name": "deleteOldBlobs",
    "enabled": true,
    "type": "Lifecycle",
    "definition": {
      "actions": {
        "baseBlob": {"delete": {"daysAfterModificationGreaterThan": 90}}
      }
    }
  }]
}

The policy shows as active in the portal, but when I check the container, I can see blobs with last modified dates from 6+ months ago. We have blob versioning enabled on the account. Policy evaluation logs don’t show any errors. Has anyone encountered similar issues with lifecycle policies not executing as expected? Our storage costs are increasing significantly and we need these old blobs removed.

That makes sense! I just checked and yes, we have tons of blob versions. I can see blobs with 15-20 versions each. So I need to add a separate rule for versions? Also, we have soft delete enabled with a 14-day retention period. Could that be interfering as well?

One thing that caught me out before - if you’re using hierarchical namespace (Data Lake Gen2), lifecycle policies work differently with directory structures. But since you mentioned this is Blob Storage, that shouldn’t apply. Have you checked the policy evaluation logs in Azure Monitor? You can query the StorageBlobLogs table to see if the policy is actually running and what actions it’s taking. Look for operations with operationName containing ‘LifecycleManagement’. That will tell you definitively whether the policy is executing or if something is blocking it.

Here’s the complete solution addressing all the issues identified:

Policy Configuration Issues: Your current policy only targets base blobs (current versions). With blob versioning enabled, you need separate rules for previous versions and snapshots. Here’s the corrected policy JSON:

{
  "rules": [{
    "name": "deleteOldContent",
    "enabled": true,
    "type": "Lifecycle",
    "definition": {
      "filters": {"blobTypes": ["blockBlob"]},
      "actions": {
        "baseBlob": {"delete": {"daysAfterModificationGreaterThan": 90}},
        "version": {"delete": {"daysAfterCreationGreaterThan": 90}},
        "snapshot": {"delete": {"daysAfterCreationGreaterThan": 90}}
      }
    }
  }]
}

Soft Delete Impact: With your 14-day soft delete retention, deleted blobs remain in storage for 14 additional days. This means total retention is 104 days (90 + 14), not 90. Soft-deleted blobs still incur storage costs at the same rate as active blobs. To see immediate cost reduction, you have three options:

  1. Reduce soft delete retention period (minimum 1 day)
  2. Adjust your lifecycle policy to delete at 76 days (76 + 14 = 90 total)
  3. Manually purge soft-deleted blobs using Azure CLI: `az storage blob delete-batch --source --delete-snapshots include --if-unmodified-since Policy Evaluation Verification: To confirm the policy is executing, check Azure Monitor logs:
  4. Navigate to your storage account > Diagnostic settings
  5. Ensure StorageBlobLogs is enabled and sent to Log Analytics
  6. Query the logs:

StorageBlobLogs
| where OperationName contains "LifecycleManagement"
| where TimeGenerated > ago(7d)
| project TimeGenerated, OperationName, StatusCode, Uri

Policies run once daily during off-peak hours (typically 1-3 AM in your storage account region). After updating your policy, allow 24-48 hours for the first evaluation cycle to complete.

Cost Monitoring: Set up a budget alert in Azure Cost Management to track storage costs daily. Tag your storage accounts appropriately so you can track which containers are driving costs. The combination of versioning + soft delete can increase storage usage by 3-5x depending on your blob modification patterns.

After implementing these changes, you should see blob versions and snapshots being deleted within 24-48 hours, followed by permanent removal of soft-deleted content after the retention period expires.