I am trying to set a rule which will delete all blobs in a container if they have not been modified for x number of days. I am following this link
The issue is, I am not able to find a rule which will work for all blobs in a specific container. I tried using container/
and container/*
but to no effect.
Can someone guide how to achieve this? Thanks
Output of Get-AzStorageAccountManagementPolicy
PS C:\windows\system32> Get-AzStorageAccountManagementPolicy -ResourceGroupName “” -StorageAccountName “”
ResourceGroupName : “” StorageAccountName : “” Id : /subscriptions/ddd /resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/storaccount/managementPolicies /default Type : Microsoft.Storage/storageAccounts/managementPolicies LastModifiedTime : 1/5/2021 10:54:21 AM Rules : [ { "Enabled": true, "Name": "allblobs", "Definition": { "Actions": { "BaseBlob": { "TierToCool": null, "TierToArchive": null, "Delete": { "DaysAfterModificationGreaterThan": 1 } }, "Snapshot": null }, "Filters": { "PrefixMatch": [ "cont1/" ], "BlobTypes": [ "blockBlob" ] } } } ]
If you want to delete all blobs in a container, then in the policy -> Filter set, just specify the container name only
. For example, if the container name is container1
, just set the Filter set as below:
Please also note that it may take effect after 24 hours. I did this settings before, and it worked well.