Reputation: 192
I have configured azure lifecycle policy for container as below,
{
"rules": [
{
"enabled": true,
"name": "name",
"type": "Lifecycle",
"definition": {
"actions": {
"baseBlob": {
"delete": {
"daysAfterModificationGreaterThan": 30
}
}
},
"filters": {
"blobTypes": [
"blockBlob"
],
"prefixMatch": [
"storageaccount/container"
]
}
}
}
]
}
So it will delete the blobs which was modified before 30 days. I am putting backups in the container so I want to delete the old backups which is 30 days older.
I configured this policy before 2 days before. Yet old backup files are not removed from the container
I analyzed and as per below links after the new policy configuration it will take up 24 hrs to take effect for new policy and policy update
Lifecycle management policy not working on Azure Data Lake Gen 2
I cant find many documents regarding this issue also
I configured Firewalls and virtual networks as 'all networks'. why i am mention this because according to below documents his solution works,
Yet there is no update in containers. So anyone know the reason and troubleshoots to resolve this? thank you!
Upvotes: 1
Views: 2111
Reputation: 10831
Please check if below points can help:
Things to check:
If version-level immutability support is enabled for a container and the container contains one or more blobs, then you must delete all blobs in the container before you can delete the container, even if there are no immutability policies in effect for the container or its blobs.
Work around :
Use az cli to add life cycle policy to delete the blobs in the container whose last modification time is more than 30 days.
Note: (Try simply specifying the container name as blob prefixcontainer name in prefixmatch instead of storageaccount/container)
Ex policy.json :
"rules": [
{
"name": "expirationRule1",
"enabled": true,
"type": "Lifecycle",
"definition": {
"filters": {
"blobTypes": [ "blockBlob" ],
"prefixMatch": [ "containername" ]
},
"actions": {
"baseBlob": {
"delete": { "daysAfterModificationGreaterThan": 30 }
}
}
}
}
]
}
Try to create this lifecycle management policy (policy.son) using the az cli command:
az storage account management-policy create --account-name youraccountname --policy @policy.json --resource-group myresourcegroup
References:
Upvotes: 3