Search code examples
azurestoragelifecycleazure-data-lake

Azure Storage - Data Lake Lifecycle Management question


Using a lifecycle management policy to move the contents of a container to archive from cool access tier.I'm trying the following policy in the hopes that it will move all files in that container to archive tier after one day but it's not working. I've set the selection criteria "after one day of not being used".

Here's the json code : { "rules": [ { "enabled": true, "name": "move to cool storage", "type": "Lifecycle", "definition": { "actions": { "baseBlob": { "tierToArchive": { "daysAfterLastAccessTimeGreaterThan": 1 } } }, "filters": { "blobTypes": [ "blockBlob" ], "prefixMatch": [ "/amcont1" ] } } } ] }

I'm checking the container after one day and two days and nothing has changed, the access tier still remains the same, cool instead of archive. Is there a way to test this interactively? 


Solution

  • You also need to give the container name in "prefixMatch" value to implement the rule.

    enter image description here

    Try the below given rule and check the result. Change the values as per your storage account. This should work fine.

    {
      "enabled": true,
      "name": "last-accessed-one-day-ago",
      "type": "Lifecycle",
      "definition": {
        "actions": {
          "baseBlob": {
            "tierToArchive": {
              "daysAfterLastAccessTimeGreaterThan": 1
            }
          }
        },
        "filters": {
          "blobTypes": [
            "blockBlob"
          ],
          "prefixMatch": [
            "mycontainer/logfile"
          ]
        }
      }
    }
    

    Refer: Move data based on last accessed time