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
Modify your sources list:
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
Get the Microsoft signing key:
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
This signing key is deprecated, and will be replaced at the end of May 2018. In order to keep getting updates with
apt, make sure that you also install the new key:
curl -L https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Install the CLI:
sudo apt-get install apt-transport-https sudo apt-get update && sudo apt-get install azure-cli
You can then run the Azure CLI with the
az command. To log in, run the
az login command.
To learn more about different login methods, see Log in with Azure CLI 2.0.
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
sudo apt-get install dirmngr
When behind a firewall blocking outgoing connections to port 11371, the
apt-key command might hang indefinitely. Your firewall may require the use of an HTTP proxy for outgoing connections:
sudo apt-key adv --keyserver-options http-proxy=http://<USER>:<PASSWORD>@<PROXY-HOST>:<PROXY-PORT>/ --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
If you do not know if you have a proxy, contact your system administrator. If your proxy does not require a login then leave out the user, password, and
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
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.
sudo apt-get remove -y azure-cli
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
Remove any unneeded packages.
sudo apt autoremove