We use the Microsoft Azure cross platform CLI Tools for interacting with Microsoft Azure. In this tutorial we will install the CLI tools and set them up to manage your Microsoft Azure Subscription. if you don't already have a subscription you can sign up for a free trial.
The CLI tools are written in node.js, so our first step is to install that. If you are using Mac or Windows as your development machines operating system you can either use the Node Package Manager (NPM), as discussed below, or you can use the native installers for your platform (Windows or Mac) and skip forward to the next section.
To install using NPM on Windows or OSX you must first visit the node.js site, click the "Install" button and, follow the installation wizard. On Linux you need to run:
sudo apt-get install nodejs-legacy
sudo apt-get install npm
Once node.js is installed, you will need to open a command prompt (on Windows you will need to open it with administrator privileges). You can then install the command line tools with:
[sudo] npm install azure-cli --global
Configuring you Azure Subscription
In order for the command line tools to work with your Azure subscription we need to configure it with your credentials. It is possible to manually login to a subscription using
azure login but in this tutorial we'll import the subscription credentials into your installation of the command line tools so that you don't need to log in manually each time.
In a command prompt/shell on your development machine run the command
azure account download. This will navigate you to a page in your browser and, after authenticating your account, will start a download of your subscription credentials. Save the file somewhere convenient then use it to import the account details into the CLI tool by running the command
azure account import [path].
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 that is currently active run the command
azure account show
If you want to change the selected subscription you can list which subscriptions are available with the command
azure account list and then change the active subscription with
azure account set [ACCOUNT]
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. For example, you might try firing up a Virtual Machine from VM Depot.