Today I received an email, from a colleague ask me if it’s there is a way that you can download the entire blob container having a SAS token via PowerShell.
After research, I found that it’s possible and I found 2 ways. One is through PowerShell and the other one is through AzCopy. Please find bellow the example of the code required to download the whole content of a blob container.
PowerShell
$BlobContent = New-AzureStorageContext -StorageAccountName $StorageAccountName -SasToken $sasToken
Get-AzureStorageBlob -Context BlobContent -Container $container | Get-AzureStorageBlobContent
Btw, the PowerShell code was based on the documented Azure Storage cmdlets (https://docs.microsoft.com/en-us/powershell/module/azure.storage/)
AzCopy
AzCopy /Source:https://<STORAGE_ACCOUNT>.blob.core.windows.net/<CONTAINER_NAME> /Dest:C:\<FOLDER> /SourceSAS:SAS1
Cheers,
Marcos Nogueira
Azure MVP
azurecentric.com
Twitter: @mdnoga
Comments