Get-AzureStorageBlob: Failed to get storage context. Go to the storage context or set the current storage context

I am using powershell with Azure cmdlets to try and just see items in blob memory

  $StorageContext = New-AzureStorageContext -StorageAccountName 'myblobname' -StorageAccountKey '2341231234asdff2352354345=='
  $Container = Get-AzureStorageContainer -Name 'mycontainer' -Context $StorageContext  
  $blobs = Get-AzureStorageBlob -Container  $Container

Error:
Get-AzureStorageBlob : Could not get the storage context.  Please pass in a storage context or set the current storage context.

      

I am 100% sure the credentials are correct (just random abbreviated credentials in this post)

Why should I get this error?

Is AzureRM in use? AzureRM version is listed as 3.8.0. What versions of scripts do I need for this?

+3


source to share


1 answer


You also need to include StorageContext

:

$blobs = Get-AzureStorageBlob -Container  $Container

      



So your code will look like this:

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

      

+4


source







All Articles