HostOnNet Blog

Installing Microsoft Azure CLI on Ubuntu 16.04

Microsoft Azure CLI is a command line tool to manage and deploy Azure Cloud. To install Azure CLI on ubuntu, run

echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
     sudo tee /etc/apt/sources.list.d/azure-cli.list

This will add the Azure repository, now we need to trust the GPG key provided by microsoft with command

sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893

press enter.

Next you can install the azure-cli with

sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli

You can access azure-cli with command “az”.

boby@hon-pc-01:~$ az --version
azure-cli (2.0.16)

acr (2.0.11)
acs (2.0.14)
appservice (0.1.15)
batch (3.1.2)
billing (0.1.4)
cdn (0.0.7)
cloud (2.0.7)
cognitiveservices (0.1.7)
command-modules-nspkg (2.0.1)
component (2.0.7)
configure (2.0.10)
consumption (0.1.4)
container (0.1.9)
core (2.0.15)
cosmosdb (0.1.12)
dla (0.0.11)
dls (0.0.13)
eventgrid (0.1.3)
feedback (2.0.6)
find (0.2.6)
interactive (0.3.9)
iot (0.1.11)
keyvault (2.0.9)
lab (0.0.10)
monitor (0.0.9)
network (2.0.13)
nspkg (3.0.1)
profile (2.0.11)
rdbms (0.0.6)
redis (0.2.8)
resource (2.0.13)
role (2.0.11)
servicefabric (0.0.3)
sf (1.0.8)
sql (2.0.10)
storage (2.0.14)
vm (2.0.13)

Python (Linux) 3.6.1 (default, Aug 31 2017, 21:03:43) 
[GCC 4.8.4]

Python location '/opt/az/bin/python3'

Legal docs and information: aka.ms/AzureCliLegal

boby@hon-pc-01:~$ 

before you can use azure-cli, you need to login to Azure with it using command

boby@hon-pc-01:~$ az login
To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code BULWQ497J to authenticate.

Posted in Cloud