Quantcast
Channel: Greg – code.commongroove.com
Viewing all articles
Browse latest Browse all 30

Azure PowerShell: Copy All Files in Blob Storage to Local Directory

$
0
0

Here’s a Azure PowerShell script that downloads all blobs in a storage container to your local disk:

 
$storageAccountName = "mysuperstorage"
$containerName = 'my-blobs'
$destinationFolder = 'C:\temp\my-blobs'
 
New-Item -ItemType Directory -Force -Path $destinationFolder
 
Login-AzureRmAccount
 
$storageAccountContext = (Get-AzureRmStorageAccount | Where-Object{$_.StorageAccountName -eq $storageAccountName}).Context
 
$blobs = Get-AzureStorageBlob -Container $containerName -Context $storageAccountContext
foreach ($blob in $blobs)
{  
  Get-AzureStorageBlobContent -Container $containerName -Blob $blob.Name -Destination $destinationFolder -Context $storageAccountContext
}

Hope this helps!


Viewing all articles
Browse latest Browse all 30

Trending Articles