Reputation: 75
How to download all the PowerShell files from the Azure storage account container to a zip folder through power shell cmdlets?
As of now, the below cmdlet helps to download a specific blob by its name
$blob = Get-AzureStorageBlobContent -Container hemac -Blob "CreateAndDeploy-Eventhubs.ps1" -Context $ctx -Destination $f -Force
Upvotes: 0
Views: 1454
Reputation: 4129
First set a folder to download all the blobs
1.Provide the full path to a directory you wish to use for downloaded blob
$DestinationFolder = "<C:\DownloadedBlobs>"
Create the destination directory and download the blob
New-Item -Path $DestinationFolder -ItemType Directory -Force
$blob | Get-AzureStorageBlobContent –Destination $DestinationFolder
Now zip the entire folder.
$folderToZip = "C:\DownloadedBlobs"
$rootfolder = Split-Path -Path $folderToZip
$zipFile = Join-Path -Path $rootfolder -ChildPath "ZippedFile.zip"
Then you should use this - docs
Compress-Archive -Path $folderToZip -DestinationPath $zipFile -Verbose
The zipped file will be in the same directory as the download folder
Upvotes: 1