Get Started with Azure - Command Line Interface (CLI)

I think I just became a huge fan of Azure CLI instead of the Azure Powershell cmdlets since few years now.

The most reason is the limitation of PowerShell which is .Net. And as you can imagine you can only install .Net on a Windows machine...

So if you need to create a simple VM on Azure from an Ubuntu machine, you cannot do that through PowerShell because you cannot install it on your machine... That's why, Microsoft release : Azure CLI Cross Platform (XPlat)

Azure CLI use Node.JS behind the scene, that mean you can use it on any platform : Windows, Linux or Mac. You just need to have Node.JS installed on it.

Installation and Prerequisites

  • As I said Azure CLI use Node.JS, so you need to have Node.JS installed on your machine, to do that follow the basic steps from the official web site : https://nodejs.org/en/
  • When you have Node.JS installed you have a package manager called NPM installed, so you can call the Azure CLI installation from this command line : npm install -g azure-cli  (you will maybe need to add sudo before this command)
  • If everything worked will, you can test by entering the word : azure in you cli, you should have :

Azure CLI

Authentification

When you have installed the CLI the first command will do to connect you Azure Subscription to your command line.

To do that you just have to enter the following command : azure login

The CLI will ask you to open your web browser to an authentification page and enter a code :

Azure Auth Azure Auth Code Azure CLi Authend

You can add multiple subscription, and check the list of the all subscription ready to be used thanks to the command : azure account list

Basics Command and Help

Azure CLI is very simple to use, you just have to add multiple sequence of word to do some actions, for example : azure vm create ...

If you don't know how used it, you have to enter the option  -h at the end .  For example, azure vm -h : Azure Help

Resources and next steps

Azure CLI is very easy to use, and you can find a multiple resources on internet. Is not dangerous to say that today you have the same options on Azure CLI than PowerShell available.

Enjoy :)

Thanks

@Ju_Stroh