Azure Archive Storage – Manage access tier on all blobs in a container
Last week Archive blob storage went into general availability. If you haven’t checked it out you can find some info here Announcing general availability of Azure Archive Storage
After some testing we realized that you cant change the access tier for an entire container or storage account from the portal. The access tier had to be set blob by blob as shown in the picture.
Here is an easy way to set the access tier with Powershell on all blobs in a specific container. This can be helpful if you have a lot of blobs that could take benefit from the new Archive access tier.
$StgAcc = "<StorageAccount>"
$StgKey = "<StorageKey>"
$Container = "<Container>"
$ctx = New-AzureStorageContext -StorageAccountName $StgAcc -StorageAccountKey $StgKey
#Get all the blobs in container
$blob = Get-AzureStorageBlob -Container $Container -Context $ctx
#Set tier of all the blobs to Archive
After successfully running the code above we could see that all our blobs had change access tier to “Archive”.
Our example is very simple and with some imagination you can take it further and for example change the access tiers of certain files with certain properties.