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:
- Ubuntu trusty, xenial, artful, and bionic
- Debian wheezy, jessie, and stretch
The current version of the CLI is 2.0.62. For information about the latest release, see the release notes. To find your installed version and see if you need to update, run
The package for Azure CLI installs its own Python interpreter, and does not use the system Python.
Get packages needed for the install process:
sudo apt-get update sudo apt-get install curl apt-transport-https lsb-release gpg
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.asc.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
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.
If the CLI can open your default browser, it will do so and load a sign-in page.
Otherwise, you need to open a browser page and follow the instructions on the command line to enter an authorization code after navigating to https://aka.ms/devicelogin in your browser.
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.
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.
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.
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 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.
sudo apt-get remove -y azure-cli
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
Remove the signing key:
sudo rm /etc/apt/trusted.gpg.d/microsoft.asc.gpg
Remove any unneeded packages:
sudo apt autoremove
Now that you've installed the Azure CLI, take a short tour of its features and common commands.
Send feedback about: