How to install Azure CLI on Ubuntu

This post explains how to install Azure CLI on Ubuntu. The Azure CLI on Ubuntu allows the execution of various commands through a terminal using interactive command-line prompts or a script.

Step 1: Get required packages for Azure CLI installation

    

sudo apt-get update
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg


Step 2: Download and install Microsoft signing key

    

curl -sL https://packages.microsoft.com/keys/microsoft.asc |
gpg --dearmor |
sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null


Step 3: Add Azure CLI software repository

    

AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" |
sudo tee /etc/apt/sources.list.d/azure-cli.list


Step 4: Update repository information

    

sudo apt-get update


Step 5: Install the azure-cli package

    

sudo apt-get install azure-cli


Step 6: Verify the installation

    

az login


On successful installation above command should open Azure sign-in page in default browser.


Category: Azure