How to Re-hydrate Blobs inside a directory Azure Storage Account


Hello Readers,

Storing data in Azure storage blobs is one widely adopted and cost-effective method but when it comes to furthermore cost-saving and keeping unused data maybe just for compliance reasons Azure blob Archive is the best option.

The major difference between Hot, Cold, and archive tires is Cost and time to retrieve, Basically when we put data in the Archive tier and when we need to see that data we need to provide Microsoft 12-15hrs of time to make that data available. Basically in the backend, Microsoft stores the data into multiple offline tapes and whenever there is a request to retrieve the data it gets plugged in back and if even a part of your data is sitting on some tape which is in the process your waiting time might increase so never ever put your folder structure directly into Archive, the best way to do it is zip it and then put it in Archive storage.

But if you have already data in the archive here is the PowerShell way to Re-hydrate the data : (Change tier from Archive to Cool or Hot)

if (Get-Module -ListAvailable -Name Az.Storage) {
  Write-Host "Module exists"
} else {
  Write-Host "Install Az module for powershell refer ( )"
  $wait = Read-Host 'Press [Enter] to exit......' 

##Credentials for Storage Access
$stgkey = Read-Host 'Please provide Storage account Key :'
$stgacc = "<Storage-Name>" # Metion Storage account Name Here 
$cont = "<Storage-Account-Container>" # Replace Container name
$destContainerName="<Storage-Account-Container>" # Replace Destination Container name
Write-host 'Please provide folder name to Rehydrate? (Case Sensitive)'
$name = Read-Host 
#Write-host 'Please provide folder name to Rehydrate? (Case Sensitive)'
## Get All Blobs
$ctx = New-AzStorageContext -StorageAccountName $stgacc -StorageAccountKey $stgkey
Write-host "Working on Fetching files..........."
$blobs = Get-AzStorageBlob -Context $ctx -Prefix "$name" -Container $cont


Write-host "Fetching complete Working on Rehydration.........."

    Foreach ($blob in $blobs) {

            Start-AzStorageBlobCopy -SrcContainer $srcContainerName -SrcBlob $blob.Name -DestContainer $destContainerName -DestBlob $destBlobName -StandardBlobTier Cool -RehydratePriority Standard -Context $ctx

            $blobn++ ;
if($blobn -eq 0){
    Write-Host "Rehydration Failed"
    Write-Host "Total Files Rehydrated :" $blobn "(Please Note the process will take 12-15hr Please check on Portal or Storage Explorer for details"
    $wait = Read-Host 'Press [Enter] to exit......'

Leave a Reply

Your email address will not be published. Required fields are marked *