Created
August 27, 2021 08:03
-
-
Save kkbruce/e2a51ded8f865cef26d4ad045339a3fb to your computer and use it in GitHub Desktop.
Download Azure Blob file by Azure PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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