Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Get all blobs name from Azure Storage

$
0
0

Hi guys,

I'm trying to get the files metadata or at least the name of the files from the blob storage.

I keep getting the following error, could you please tell me what I am doing wrong? 

Get-AzureStorageBlob : Could not get the storage context.  Please pass in a storage context or set the current storage context.
At line:16 char:10
+ $blobs = Get-AzureStorageBlob -Container $ContainerName
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureStorageBlob], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand

Here is my PS Syntax.

Clear-Host
$SubscriptionName = "MySubscriptionName"
$StorageAccountName = "MyStorageAccountName"
$StorageAccountKey = "MyStorageAccountKey"
$ContainerName = "MyContainerName"

#Set up the storage account context
$ctx = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey

Get-AzureStorageContainer -Context $ctx

$blobs = Get-AzureStorageBlob -Container $ContainerName

$blobs


Codernater


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>