How to list Azure Storage Containers and Blobs How to list Azure Storage Containers and Blobs powershell powershell

How to list Azure Storage Containers and Blobs


Not sure if this is what you want, but I am able to list containers using New-AzureStorageContext and Get-AzureStorageContainers.

$ctx = New-AzureStorageContext -StorageAccountName <name> -StorageAccountKey <key>Get-AzureStorageContainer -Context $ctx


With the new Az module, you need to do the following

Import-Module Az$azStorageAccountName = "" # Name of your storage account $azStorageAccountKey = "" # Access key for your storage account$azContainerName = "" # Container name to list your blobs$azResourceGroupName = "" # Resource group name where storage account lives$connectionContext = (Get-AzStorageAccount -ResourceGroupName $azResourceGroupName -AccountName $azStorageAccountName).Context# Get a list of containers in a storage accountGet-AzStorageContainer -Name $azContainerName -Context $connectionContext | Select Name# Get a list of blobs in a container Get-AzStorageBlob -Container $azContainerName -Context $connectionContext | Select Name


List all containers

Get-AzureStorageContainer

List all blobs in a container.

Get-AzureStorageBlob -Container $ContainerName

There is also a complete Getting Started Guide for PowerShell and Azure Storage which you can find here. Azure Storage PowerShell Getting Started