Muthusankar
Muthusankar

Reputation: 5

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.

Upvotes: 0

Views: 1404

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136346

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

Upvotes: 1

Related Questions