Storage account Lifecycle management with filter on specific container does not delete the files

Galgani, Stefano 205 Reputation points
2023-08-02T06:51:33.08+00:00

Hi all,

I have a storage account with 3 containers defined.
I applied the lifecycle management by filter to delete all files where the last modified date is older than 1 day that are contained in test-legacy container.

triplog-legacy

the rule applied is the followed:

{
  "rules": [
    {
      "enabled": true,
      "name": "testrule01",
      "type": "Lifecycle",
      "definition": {
        "actions": {
          "version": {
            "delete": {
              "daysAfterCreationGreaterThan": 1
            }
          },
          "baseBlob": {
            "delete": {
              "daysAfterModificationGreaterThan": 1
            }
          },
          "snapshot": {
            "delete": {
              "daysAfterCreationGreaterThan": 1
            }
          }
        },
        "filters": {
          "blobTypes": [
            "blockBlob"
          ],
          "prefixMatch": [
            "test-legacy/*"
          ]
        }
      }
    }
  ]
}

I set test-legacy/* value in the prefix match key, but it doesn't work.

Where am I wrong ?

Thanks

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,533 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,278 questions
{count} votes

Accepted answer
  1. Ramya Harinarthini_MSFT 5,136 Reputation points Microsoft Employee
    2023-08-02T07:25:38.9166667+00:00

    @Galgani, Stefano Welcome to Microsoft Q&A, thank you for posting your here!

    The asterisk character * is a valid character in a blob name. If the asterisk character is used in a prefix, then the prefix will match blobs with an asterisk in their names. The asterisk doesn't function as a wildcard character.

    A prefix match string like container1/ applies to all blobs in the container named container1. A prefix match string of container1, without the trailing forward slash character (/), applies to all blobs in all containers where the container name begins with the string container1. The prefix will match containers named container11, container1234, container1ab, and so on.

    https://learn.microsoft.com/en-us/azure/storage/blobs/lifecycle-management-overview#the-blob-prefix-match-string-didnt-apply-the-policy-to-the-expected-blobs

    Hope this helps!
    Kindly let us know if the above helps or you need further assistance on this issue.


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful