Cloud Infrastructure Community's Space

Install Azure CLI on Ubuntu 22.04

The Azure CLI is a cross-platform command-line tool that can be installed locally on Linux computers. You can use the Azure CLI on Linux to connect to Azure and execute administrative commands on Azure resources. The CLI on Linux allows the execution of various commands through a terminal using interactive command-line prompts or a script. When you are ready to install the Azure CLI on Linux, it is recommended to use a Linux distribution’s package manager. Select the appropriate package manager for your distribution from the options above. If you do not have one of the listed package managers, you may manually install the Azure CLI on Linux by selecting the Install script option.

Overview

The apt package manager contains an x86_64 package for the Azure CLI that has been tested on the following distributions.

DistributionVersion
Ubuntu18.04 LTS (Bionic Beaver), 20.04 LTS (Focal Fossa), 22.04 (Jammy Jellyfish)
Debian10 (Buster), 11 (Bullseye)

Option 1: Install with one command

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Option 2: Step-by-step installation instructions

Get packages needed for the install process:

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

Download and install the 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

Add the 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

Update repository information and install the azure-cli package:

sudo apt-get update
sudo apt-get install azure-cli

Option 3: Install specific version

You must first configure azure-cli repository information as shown above. Available versions can be found at Azure CLI release notes.

To view available versions with command

apt-cache policy azure-cli

To install specific version:

sudo apt-get install azure-cli=<version>-1~bullseye

Press ESC to close