How to Install Azure Command Line Interface(CLI) on Azure Virtual Server


You can easily access Azure resources using Azure command line interface.

Step 1. Login into your Microsoft Azure account.

Step 2. Open your virtual server on which you want to install command line interface & update your Packages.

# apt-get update

Step 3. Install Nodejs Tools.

# apt-get install  nodejs-legacy -y

Step 4. Install Node Package Manager(NPM) Tool.

# apt-get install npm -y

Step 5. Install Azure cli Tools with the help of Node Package Manager(NPM).

# npm install -g azure-cli

Step 6. Your azure CLI tool is installed successfully.You can check CLI tool by using azure command.

# azure

Step 7. Now execute the azure login command & copy the generated code.In my case the code is EGCTMWKBC

# azure login

Step 8. Open link & paste the copied code under the device Login box.After that click on Continue.


Note : Once you have logged into your Azure Subscription Successfully you will be directed to this webpage

Step 9. Now move back over your putty will see that you are successfully logged into azure via cli tool on your virtual machine.

Step 10. You can test your azure cli by executing below azure command.

# azure vm list