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:
- Reduce soft delete retention period (minimum 1 day)
- Adjust your lifecycle policy to delete at 76 days (76 + 14 = 90 total)
- 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:
- Navigate to your storage account > Diagnostic settings
- Ensure StorageBlobLogs is enabled and sent to Log Analytics
- 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.