Created
November 13, 2015 15:25
-
-
Save Gimly/3d1a10e1f0d004e8b68a to your computer and use it in GitHub Desktop.
Copy files from an Azure Blob storage container to a local folder
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
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$True)] | |
[string]$ReleaseFolder, | |
[Parameter(Mandatory=$True)] | |
[string]$StorageAccountName, | |
[Parameter(Mandatory=$True)] | |
[string]$StorageAccountKey, | |
[Parameter(Mandatory=$True)] | |
[string]$Container | |
) | |
$storage_account = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey | |
Write-Host "Getting the release directory back from Azure blob storage" | |
$blobs = Get-AzureStorageBlob -Container $Container -Context $storage_account | |
New-Item -ItemType Directory -Force -Path $ReleaseFolder | |
foreach ($blob in $blobs) | |
{ | |
Get-AzureStorageBlobContent ` | |
-Container $Container -Blob $blob.Name -Force -Destination $ReleaseFolder ` | |
-Context $storage_account | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment