Install Azure CLI with apt

If you are running a distribution that comes with apt, such as Ubuntu or Debian, there's an x86_64 package available for the Azure CLI. This package has been tested with and is supported for:

  • Ubuntu trusty, xenial, bionic, eoan and focal
  • Debian jessie, stretch, and buster

The current version of the Azure CLI is 2.14.0. For information about the latest release, see the release notes. To find your installed version and see if you need to update, run az --version.


The package for Azure CLI installs its own Python interpreter, and does not use the system Python.

On Ubuntu 20.04 (Focal), there is an azure-cli package with version 2.0.81 provided by the focal/universe repository. It's outdated and not recommended. If you already installed it, please remove it first by running sudo apt remove azure-cli -y && sudo apt autoremove -y before following the below steps to install the latest azure-cli package.


We offer two ways to install the Azure CLI with distributions that support apt: As an all-in-one script that runs the install commands for you, and instructions that you can run as a step-by-step process on your own.

Install with one command

We offer and maintain a script which runs all of the installation commands in one step. Run it by using curl and pipe directly to bash, or download the script to a file and inspect it before running.


This script is only verified for Ubuntu 16.04+ and Debian 8+. It may not work on other distributions. If you're using a derived distribution such as Linux Mint, follow the manual install instructions and perform any necessary troubleshooting.

curl -sL | sudo bash

Manual install instructions

If you don't want to run a script as superuser or the all-in-one script fails, follow these steps to install the Azure CLI.

  1. Get packages needed for the install process:

    sudo apt-get update
    sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg
  2. Download and install the Microsoft signing key:

    curl -sL |
        gpg --dearmor |
        sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
  3. Add the Azure CLI software repository:
    AZ_REPO=$(lsb_release -cs)
    echo "deb [arch=amd64] $AZ_REPO main" |
        sudo tee /etc/apt/sources.list.d/azure-cli.list
  4. Update repository information and install the azure-cli package:

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

Run the Azure CLI with the az command. To sign in, use the az login command.

  1. Run the login command.

    az login

    If the CLI can open your default browser, it will do so and load an Azure sign-in page.

    Otherwise, open a browser page at and enter the authorization code displayed in your terminal.

  2. Sign in with your account credentials in the browser.

To learn more about different authentication methods, see Sign in with Azure CLI.


Here are some common problems seen when installing with apt. If you experience a problem not covered here, file an issue on github.

No module issue on Ubuntu 20.04 (Focal)/WSL

If you installed azure-cli on Focal without adding the Azure CLI software repository in step 3 of the manual install instructions or using our script, you may encounter issues such as no module named 'decorator' or 'antlr4' as the package you installed is the outdated azure-cli 2.0.81 from the focal/universe repository. Please remove it first by running sudo apt remove azure-cli -y && sudo apt autoremove -y, then follow the above instructions to install the latest azure-cli package.

lsb_release does not return the correct base distribution version

Some Ubuntu- or Debian-derived distributions such as Linux Mint may not return the correct version name from lsb_release. This value is used in the install process to determine the package to install. If you know the code name of the Ubuntu or Debian version your distribution is derived from, you can set the AZ_REPO value manually when adding the repository. Otherwise, look up information for your distribution on how to determine the base distribution code name and set AZ_REPO to the correct value.

No package for your distribution

Sometimes it may be a while after a distribution is released before there's an Azure CLI package available for it. The Azure CLI designed to be resilient with regards to future versions of dependencies and rely on as few of them as possible. If there's no package available for your base distribution, try a package for an earlier distribution.

To do this, set the value of AZ_REPO manually when adding the repository. For Ubuntu distributions use the bionic repository, and for Debian distributions use stretch. Distributions released before Ubuntu Trusty and Debian Wheezy are not supported.

Elementary OS (EOS) fails to install the Azure CLI

EOS fails to install the Azure cli because lsb_release returns HERA, which is the EOS release name. The solution is to fix the file /etc/apt/sources.list.d/azure-cli.list and change hera main to bionic main.

Original file contents:

deb [arch=amd64] hera main

Modified file contents

deb [arch=amd64] bionic main

Proxy blocks connection

If you're unable to connect to an external resource due to a proxy, make sure that you've correctly set the HTTP_PROXY and HTTPS_PROXY variables in your shell. You will need to contact your system administrator to know what host(s) and port(s) to use for these proxies.

These values are respected by many Linux programs, including those which are used in the install process. To set these values:

# No auth
export HTTP_PROXY=http://[proxy]:[port]
export HTTPS_PROXY=https://[proxy]:[port]

# Basic auth
export HTTP_PROXY=http://[username]:[password]@[proxy]:[port]
export HTTPS_PROXY=https://[username]:[password]@[proxy]:[port]


If you are behind a proxy, these shell variables must be set to connect to Azure services with the CLI. If you are not using basic auth, it's recommended to export these variables in your .bashrc file. Always follow your business' security policies and the requirements of your system administrator.

You may also want to explicitly configure apt to use this proxy at all times. Make sure that the following lines appear in an apt configuration file in /etc/apt/apt.conf.d/. We recommend using either your existing global configuration file, an existing proxy configuration file, 40proxies, or 99local, but follow your system administration requirements.

Acquire {
    http::proxy "http://[username]:[password]@[proxy]:[port]";
    https::proxy "https://[username]:[password]@[proxy]:[port]";

If your proxy does not use basic auth, remove the [username]:[password]@ portion of the proxy URI. If you require more information for proxy configuration, see the official Ubuntu documentation:

In order to get the Microsoft signing key and get the package from our repository, your proxy needs to allow HTTPS connections to the following address:


CLI fails to install or run on Windows Subsystem for Linux

Since Windows Subsystem for Linux (WSL) is a system call translation layer on top of the Windows platform, you might experience an error when trying to install or run the Azure CLI. The CLI relies on some features that may have a bug in WSL. If you experience an error no matter how you install the CLI, there's a good chance it's an issue with WSL and not with the CLI install process.

To troubleshoot your WSL installation and possibly resolve issues:

  • If you can, run an identical install process on a Linux machine or VM to see if it succeeds. If it does, your issue is almost certainly related to WSL. To start a Linux VM in Azure, see the create a Linux VM in the Azure Portal documentation.
  • Make sure that you're running the latest version of WSL. To get the latest version, update your Windows 10 installation.
  • Check for any open issues with WSL which might address your problem. Often there will be suggestions on how to work around the problem, or information about a release where the issue will be fixed.
  • If there are no existing issues for your problem, file a new issue with WSL and make sure that you include as much information as possible.

If you continue to have issues installing or running on WSL, consider installing the CLI for Windows.


The CLI provides an in-tool command to update to the latest version:

az upgrade


The az upgrade command was added in version 2.11.0 and will not work with versions prior to 2.11.0.

This command will also update all installed extensions by default. For more az upgrade options, please refer to the command reference page.

You can also use apt-get upgrade to update the CLI package.

sudo apt-get update && sudo apt-get upgrade


This command upgrades all of the installed packages on your system that have not had a dependency change. To upgrade the CLI only, use apt-get install.

sudo apt-get update && sudo apt-get install --only-upgrade -y azure-cli


If you decide to uninstall the Azure CLI, we're sorry to see you go. Before you uninstall, use the az feedback command to let us know what could be improved or fixed. Our goal is to make the Azure CLI bug-free and user-friendly. If you found a bug, we'd appreciate it if you file a GitHub issue.

  1. Uninstall with apt-get remove:

    sudo apt-get remove -y azure-cli
  2. If you don't plan to reinstall the CLI, remove the Azure CLI repository information:

    sudo rm /etc/apt/sources.list.d/azure-cli.list
  3. If you use no other packages from Microsoft, remove the signing key:

    sudo rm /etc/apt/trusted.gpg.d/microsoft.gpg
  4. Remove any unneeded packages:

    sudo apt autoremove

Next Steps

Now that you've installed the Azure CLI, take a short tour of its features and common commands.