Most cloud providers have done a good job at putting together a web ui that allows you to manage the cloud assets such as Virtual Machines (vms). But when trying to manage many vms or just wanting to perform some simple tasks as starting a vm command line interfaces #cli can’t be beat.
#Azure is no exception to this and they have provided a couple of means of manazing your account, assets etc via a #cli. They provide two ways of doing this either through #PowerShell or the cross platform cli based on #nodejs. I choose the later as the prefered mechanism as it’s cross platform and it seems the like the simplest way of using it.
To get started 1st download #nodejs http://nodejs.org/download/ for the platform you’re working on. There are number of prebuild packages but you can build it from source code as well. Next you’ll need to use the node.js package manager #npm to install the azure component:
npm install azure-cli -g
Now that you have installed this part you’re ready to link your account to the cli. You do this by downloading the settings and then importing them. Using the azure command download this will start the download. In which your default browser will be loaded, login to azure with the account you want to link and the download starts.
azure account download
After the file is downloaded you can then import the account by using the import command. Below is the example of the file “Visual Studio U-13-2014-credentials.publishsettings” was downloaded by the browser and using the import command we add it to my profile for the cli.
azure account import "C:\Users\yourtruly\Downloads\Visual Studio U-13-2014-credentials.publishsettings"
Now you’re ready to use the azure commands. Here are some example commands:
List your vms:
azure vms list
Create a Ubuntu vm:
azure vm create
b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_4-LTS-amd64-server-20140514-en-us-30GB azureuser password –location “West US” -e 22
Check out the references:
http://azure.microsoft.com/en-us/documentation/articles/command-line-tools/#Commands_to_manage_your_Azure_virtual_machines
http://www.hanselman.com/blog/ManagingTheCloudFromTheCommandLine.aspx