Install Azure CLI 2.0 with apt

If you are running a distribution that comes with apt, such as Ubuntu or Debian, there is a 64-bit package available for the Azure CLI. This package has been tested with:

  • Ubuntu trusty, xenial, and artful
  • Debian wheezy, jessie, and stretch


  1. Modify your sources list:

    AZ_REPO=$(lsb_release -cs)
    echo "deb [arch=amd64] $AZ_REPO main" | \
         sudo tee /etc/apt/sources.list.d/azure-cli.list
  2. Run the following sudo commands:

    sudo apt-key adv --keyserver --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
    sudo apt-get install apt-transport-https
    sudo apt-get update && sudo apt-get install azure-cli

You can run the Azure CLI with the az command.


Here are some common problems seen when installing with apt. If your issue is not listed here, please file an issue on github.

apt-key fails with "No dirmngr"

When running the apt-key command, you may see output similar to the following error:

gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.kt5zo27tp1/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr

The error is due to a missing component required by apt-key. You can resolve it by installing the dirmngr package.

sudo apt-get install dirmngr


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 give some reasons why you chose to uninstall and how the CLI could be improved to help you. Our goal is to make the Azure CLI bug-free and user-friendly. If you encountered a bug, please file a github issue.

  1. Uninstall with apt-get remove.

    sudo apt-get remove -y azure-cli
  2. If you do not plan to reinstall the CLI, remove the Azure CLI repository information.

    sudo rm /etc/apt/sources.list.d/azure-cli.list
  3. Remove any unneeded packages.

    sudo apt autoremove