简体   繁体   中英

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

I tried to access the public blob storage container items through powershell web CLI, but facing below issue.

Code:

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

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

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

Error:

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.

I believe you're getting this error is because you're passing an object for -Container parameter however as per the documentation here , it should be a string.

Please try the following:

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

or

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM