Posted in : Azure Av Tobias Vuorenmaa Översätt med Google ⟶
6 years ago
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 $blob.icloudblob.setstandardblobtier("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.
Tags : Archive, Azure, Blob, Cloud storage, Container, Storage
Personlig rådgivning
Vi erbjuder personlig rådgivning med författaren för 1400 SEK per timme. Anmäl ditt intresse i här så återkommer vi så snart vi kan.
Comments
Pavel says
there is a typo in $blob = Get-AzureStorageBlob -Container $Conatiner -Context $ctx, should be $blob = Get-AzureStorageBlob -Container $Container -Context $ctx instead
Tobias Vuorenmaa says
Hi Pavel,
Thanks for pointing the typo out. I have updated the paramter.
Have a good day!
Add comment