Get-AzStorageBlob:容器名称 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageContainer' 无效

Get-AzStorageBlob: Container name 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageContainer' is invalid

我尝试通过 powershell web CLI 访问 public blob 存储容器项目,但遇到以下问题。

代码:

$StorageContext = New-AzureStorageContext -StorageAccountName 'muthudev' -StorageAccountKey 'QMv77eoYUQcnb1QfvGjsGOd+gg=='

$Container = Get-AzureStorageContainer -Name 'public' -Context $StorageContext

$blobs = Get-AzureStorageBlob -Container $Container -Context $StorageContext

错误:

Get-AzStorageBlob: Container name 'Microsoft.WindowsAzure.Commands.Common.Storage.ResourceModel.AzureStorageContainer' is invalid. Valid names start and end w ith a lower case letter or a number and has in between a lower case letter, number or dash with no consecutive dashes and is 3 through 63 characters long.

我认为您收到此错误是因为您为 -Container 参数传递了一个对象,但是根据文档 here,它应该是一个字符串。

请尝试以下操作:

$blobs = Get-AzureStorageBlob -Container 'public' -Context $StorageContext

$blobs = Get-AzureStorageBlob -Container $Container.Name -Context $StorageContext