Skip to content

Instantly share code, notes, and snippets.

@kkbruce
Created August 27, 2021 08:03
Show Gist options
  • Save kkbruce/e2a51ded8f865cef26d4ad045339a3fb to your computer and use it in GitHub Desktop.
Save kkbruce/e2a51ded8f865cef26d4ad045339a3fb to your computer and use it in GitHub Desktop.
Download Azure Blob file by Azure PowerShell
#!pwsh
Import-Module Az.Accounts
Import-Module Az.Storage
Connect-AzAccount
$resourceGroup = "RG"
$storageAccountName = "AN"
$containerName = "CN"
$destinationPath = "Path"
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourceGroup -Name $storageAccountName
$ctx = $storageAccount.Context
$blob = Get-AzStorageBlob -Container $containerName -Context $ctx
Get-AzStorageBlobContent `
-Blob $blob.Name `
-Container $containerName `
-Destination $destinationPath `
-Context $ctx
Disconnect-AzAccount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment