Fork me on GitHub
24 July 2015

There are many ways of managing your Azure subscription and the resources within it. One of the most flexible is with the Azure Command Line Interface. Here’s how to install the cross platform CLI on Linux, OS X or Windows.


The Azure Cross Platform Command Line Interface (Azure X-Plat CLI) is written in Node.js. Therefore, the first thing you must do is install Node.js from

There are CLI installers available for OS X and Windows which will isntall Node for you, but I prefer to install using the Node Package Manager (NPM), it’s just as easy. It’s the NPM approach I describe below.

Installing Azure X-Plat CLI

Once you have installed Node and NPM you simply run the following command to install the Azure X-Plat CLI:

npm install azure-cli --global

On Linux you will likely need to use ‘sudo’.

Obtaining an Azure Subscription

If you already have an Azure subscription you can skip to the next section. If you have an MSDN subscription then you can activiate your included Azure credits. Alternatively you can start a free trial.

Configuring your Azure Subscription

In order for the command line tools to work with your Azure subscription you need to configure it with your credentials. It is possible to manually login to a subscription using:

azure login 

However, this method makes it difficult to script the management of your Azure resources. If you want to script things, or even just prevent the need to log in each time you use the tools, you can import your subscription credentials into your installation of the command line tools. Run the command:

azure config mode asm
azure account download 

This will open the Azure login page in your browser and, after authenticating your account, will start a download of your subscription credentials. Save the file somewhere convenient and then import the account details into the CLI tool by running the following command:

azure account import [path] 

Managing Multiple Subscriptions

If you have more than one subscription attached to your live id you will need to ensure that the right subscription is being used. To see which subscription is currently active run the following command:

azure account show

If you want to change the selected subscription you can list which subscriptions are available with:

azure account list and

Finally, you can change the active subscription with:

azure account set [ACCOUNT] 

Upgrading to the Latest Version

Like all Node packages you can upgrade to the latest version with the ‘upgrade’ command:

npm -g upgrade azure-cli

Using the Azure cross platform CLI Tools

That’s it! You are now ready to use the command line tool to manage your Azure subscription. The features of the CLI are well documented, one of the first things you could try is deploying an ARM template.

Related Posts

blog comments powered by Disqus