Search code examples
azure-storageazure-blob-storageazure-storage-files

How to find hot or cool files in blob container


Is there some way or script to search in your blob container which files are hot or cool to change the to archive?

I have thousands of folders and files and to make this work manually is a nightmare


Solution

  • If you want to change the blob tier(hot or cool) to archive tier, there is a built-in feature named lifecycle management.

    You can just set a rule for your storage account(the rule can be applied for container level or account level or subfolder level as per your need), then the blob service can automatically change the tier(hot and cool) to archive.

    Here is an example for container level:

    1.Nav to azure portal -> your storage account -> lifecycle management, then click "Add a rule":

    enter image description here

    1. In the Details panel -> Specify a "rule name", select "Rule scope"(here, select "Limit blobs with filter" for container level), "Blob type" and "Blob subtype":

    enter image description here

    3.In the "Base blobs", specify the settings as below:

    enter image description here

    4.In "Filter set", just type your container name for Prefix match:

    enter image description here

    5.Click "Add" button to save the rule. Note that the rule will be executed after 24 hours.