问题
I am using following command to download blob from provided container but it give me following exception.
Code
$subscriptionName = "mysubscrition"
$storageAccount = "myaccount"
$containerName = "mycontainer"
Set-AzureSubscription -SubscriptionName $subscriptionName -CurrentStorageAccount $storageAccount
Get-AzureStorageContainer -Container $containerName
Get-AzureStorageBlob -Container $containerName | Sort LastModified -Descending |Select-Object -First 1 | Get-AzureStorageBlobContent -Blob name -Destination "C:\BlobDownload" -Force | Out-Null
Excetion
Get-AzureStorageBlobContent : Could not load file or assembly 'Microsoft.WindowsAzure.Storage.DataMovement, Version=2.2.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
At line:7 char:106
+ Get-AzureStorageBlob -Container $containerName | Sort LastModified -Descending | ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzureStorageBlobContent], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobContentCommand
回答1:
This appears to be a transient install issue. Can you try reinstalling as follows:
(1) uninstall (2) Remove webpi cache directrory (~\appdata\local\Microsoft\Web Platform Installer) (3) install a fresh copy from webpi
回答2:
This is actually caused by an issue with the wix installer and the version number of the Storage.DataMovement dll. During an upgrade, the Windows Installer will not replace a file with a lower version of the same file. What happes is that the file is marked for deletion, the replacement with the lower version file is disallowed, and then the file is removed (but not replaced).
You can solve this in two ways:
(1) Repair the install in Control Panel -> Uninstall a program
(2) Replace with a more recent version (0.8.5, for example). The more recent versions should not display this issue
来源:https://stackoverflow.com/questions/21891167/get-azurestorageblobcontent-exception-to-download-a-blob