Manage Azure Storage Account using Azure CLI

ByHariharan Rajendran

Manage Azure Storage Account using Azure CLI

We can manage storage account through Azure Portal or PowerShell Scripts.

This article will explain you the commands that you need to use inside Azure CLI to manage storage account.

Download the Azure CLI in following link and choose respective installer package.


Install it on your machine. if you are working with Azure and if you had installed different tools to interact with Azure, you may have different command line tools in your machine. To find the recently installed one, just search for “Microsoft Azure Command Prompt”.

You will see a tool like below,


#First login into Azure using below command

azure login

You need to open the following link in your browser, and provide the given code to authenticate.

If you have multiple subscription, then you can able to choose the default one.

#List out all the subscriptions

azure account list

#To set the default subscription

azure account set “name of your subscription”

#Create a storage account on the selected subscription

azure storage account create <storage account name>

Above script will ask you to provide two values, “Account Type” & “Location”. Just provide the numbers of the respective information.


To create a containers or all other storage services, we need to fix the created storage account details in environment variable so that when we run a further commands, it will consider the correct storage account. If you missed to set up environment variable then you will end up with following error.


Azure has command called “export” which is used to hold your storage connection string, just like a variable but it is not working as expected. If you try like below,

    export AZURE_STORAGE_ACCOUNT=<account_name>

You will get below error. So we can follow different approach to have environment variable.

‘export’ is not recognized as an internal or external command,
operable program or batch file.


#Get the connection string of storage account

azure storage account connectionstring show <storage account name>

#Set Azure Connection string as environment Variable


#Create a container

azure storage container create <container name>


#Upload the blobs
azure storage blob upload <Path>  <container name>  <blob name>

azure storage blob upload E:\Encryption.png logs myblob

#Download the blobs
azure storage blob download <container name>  <blob name>  <local path>


azure storage blob download logs myblob E:\log.png

#Delete blobs
azure storage blob delete <container name> <blob name>

azure storage blob delete logs myblog


About the Author

Hariharan Rajendran author

Hariharan Rajendran is a MVP in Data Platform and Microsoft Certified Trainer with 10+ years of experience in Database, BI and Azure platforms. Hariharan is also an active community leader, speaker & organizer and leads the Microsoft PUG (Power BI User Group – Chennai), SQLPASS Power BI Local Group – Chennai and an active speaker in SQL Server Chennai User Group and also a leader in Data Awareness Program worldwide events. Hariharan also frequently blogs (, provides virtual training (on ad-hoc basis) on Microsoft Azure, Database Administration, Power BI and database development to worldwide clients/audience.

Comments Are Closed!!!