locked
Move Blobs from Hot to Archive RRS feed

  • Question

  • Hi,

    I've container with 68k blobs .

    What is the best way to move all the blobs from hot tier to archive tier ?

    I tried to use the powershell script but it chokes my router and i lost my internet connection so its failed. (No problem if i do it for 100 blobs)

    $blob = Get-AzureStorageBlob -Container $Container -Context $ctx

    #Set tier of all the blobs to Archive
    $blob.icloudblob.setstandardblobtierAsync("Archive")

    Thanks in advance.

    Thursday, January 24, 2019 11:28 PM

Answers

All replies

  • Hi Jordan,

    you should consider running the PowerShell script from Azure Automation

    https://docs.microsoft.com/en-us/azure/automation/automation-first-runbook-textual-powershell

    hth
    Marcin

    • Marked as answer by jordan_ch Friday, January 25, 2019 7:09 PM
    Friday, January 25, 2019 2:02 AM
  • Thanks !

    I just tried it but got an error:

    Method invocation failed because [Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob] does not contain a method named 'SetstandardblobtierAsync'.

    Although it does exist (and passed when i run it from my powershell env.

    Do you know what can be the problem ?

    Thanks in advance,

    Jordan.

    Friday, January 25, 2019 2:17 PM
  • Hello Jordan_ch,

    Make sure to use the latest Azure PowerShell module:

    install-module Azure -requiredVersion 4.4.0

    You can use the below Power Shell script for changing the access tier for all blobs within a container

    #Account information
    $StorageAccount = "[Enter your Storage Account name here]"
    
    $StorageAccountKey = "[Enter your Storage Account key here]"
    
    $containername = "[Enter your container name here]" 
    
    #Create a storage context
    
    $context = New-AzureStorageContext -StorageAccountName $StorageAccount -StorageAccountKey $StorageAccountKey
    
    $blobs = Get-AzureStorageBlob -Container $containerName -Context $context 
    
    #Change the access tier
    
    Foreach ($blob in $blobs) {
    
    $blob.ICloudBlob.SetStandardBlobTier("Archive")
    
    }
    See if this helps you. Let us know if you need any further assistance on this.



    Friday, January 25, 2019 3:35 PM
    • Marked as answer by jordan_ch Friday, January 25, 2019 7:09 PM
    Friday, January 25, 2019 4:07 PM
  • It works, Thanks !

    I hope Microsoft is working on an option to change to archive and back on container basis.

    Friday, January 25, 2019 7:11 PM
  • Glad to know that your issue is resolved.

    The new storage feature (Blob life cycle management)would help you.

    • Proposed as answer by YASWANTH MADI Monday, January 28, 2019 8:48 AM
    Monday, January 28, 2019 8:48 AM