How to get the Azure storage container blobs (files) using Azure CLI in PowerShell?

Microsoft TechnologiesSoftware & CodingPowerShell

To get the azure storage container blobs using Azure CLI, we can use “az storage account” along with the blob commands. If you are not connected to the Azure cloud then use “az login” and set the proper subscription using “az account set” before running the storage commands.

To get access to the Azure storage account, we will use here storage connection string. In the below example, we are retrieving the connection string and store it into the variable.

$storageaccount = 'az204storage05june'
$connectionstring = az storage account show-connection-string -
n $storageaccount -otsv

Once we have the connection string available, we can retrieve the blobs (Files) stored in the container.

az storage blob list --container-name container1 --connectionstring $connectionstring -otable


Updated on 01-Sep-2021 08:03:23