How to Get All the Containers From a Specific Azure Storage Account using Azure CLI?

805 Views Asked by At

How to Get All the Containers From a Specific Azure Storage Account using Azure CLI? How to set context in azure cli like we set context in Powershell? $ctx = $storageAccount.Context

How can we achieve this using Azure CLI?

Get the storage account from which container has to be retrieved

Get the storage account context

List all the containers

1

There are 1 best solutions below

0
On BEST ANSWER

Get All the Container list

az storage container list --account-name <Storage Account Name> --account-key <Storage Account Key> --query "[].{Name:name}" --output table

enter image description here

Set & Get Context

# example to set the Az context
Set-AzContext -Subscription  "XXXX-XXXX-XXXX-XXXX"

Refer Set AzContext & Get AzContext