我正在尝试使用Powershell获得天蓝色的容器blob内容。
代码
$Ctx = New-AzStorageContext -StorageAccountName abc -StorageAccountKey 'xxxx=='
$latestBuild = Get-AzStorageBlob -Context $Ctx -Container jmeter -blob "Script\Load1"
if($latestBuild -ne $null)
{
foreach($item in $latestBuild)
{
Get-AzStorageBlobContent -Blob $item.name -Container jmeter -Destination C:\ -Context $Ctx -Force
}
}
else
{
write-host "Blob is empty !!!"
}
错误
Get-AzStorageBlob : Can not find blob 'Script\Load1' in container 'jmeter', or the blob type is unsupported.
At line:2 char:16
+ ... testBuild = Get-AzStorageBlob -Context $Ctx -Container jmeter -blob " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-AzStorageBlob], ResourceNotFoundException
+ FullyQualifiedErrorId : ResourceNotFoundException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand
Blob is empty !!!
Load1文件夹中存在两个文件:
答案 0 :(得分:1)
这不是它的工作方式,您必须做不同的事情:
Get-AzStorageBlob -Context $Ctx -Container jmeter -Prefix "Script/Load1"
或者只是:
Get-AzStorageBlob -Context $Ctx -Container jmeter -Blob "Script/Load1*"
https://docs.microsoft.com/en-us/powershell/module/az.storage/get-azstorageblob?view=azps-3.6.1