I need to delete all blobs residing in a particular container in my storage account after 1 day since creation. To do that I have tried to set a policy but I cant make it work so far.
I have tried to create the policy both by using the azure portal and by using terraform. The policy code view shown in the portal is the following:
{
"rules": [
{
"enabled": true,
"name": "delete_old_records_csv_files",
"type": "Lifecycle",
"definition": {
"actions": {
"baseBlob": {
"delete": {
"daysAfterCreationGreaterThan": 1
}
}
},
"filters": {
"blobTypes": [
"blockBlob"
],
"prefixMatch": [
"queryresults"
]
}
}
}
]
}
I have waited 2 days for the files to get deleted but they did not. Is there something I am doing wrong?
Thanks!
I have waited 2 days for the files to get deleted but they did not. Is there something I am doing wrong?
48Hrs
to complete.Portal:
"queryresults"
as same as in the specified policy.If everything is correct but still not being deleted, you can debug your storage account by using audit logs
and if you get warning that will explain why the policy is not working.
Reference: azure - Lifecycle management rule not working for ADLS Gen2 Storage Account - Stack Overflow by Joel Cochran.