Skip to content

Latest commit

 

History

History
108 lines (71 loc) · 3.5 KB

cli-install-linux-script.md

File metadata and controls

108 lines (71 loc) · 3.5 KB
author ms.author ms.date ms.topic ms.service ms.custom
dbradish-microsoft
dbradish
06/17/2024
include
azure-cli
devx-track-azurecli, linux-related-content

Before you begin

It's strongly recommend to install the CLI with a package manager. A package manager makes sure you always get the latest updates, and guarantees the stability of CLI components. Check and see if there's a package for your distribution before installing manually.

The install script for the Azure CLI requires the following software:

Install or update Azure CLI

Important

The install script only works on Python 3.8.x, 3.9.x, or 3.10.x. This install script does not work on Python 3.11.x or later versions.

Both installing and updating the Azure CLI requires rerunning the install script:

curl -L https://aka.ms/InstallAzureCli | bash

The script can also be downloaded and run locally. You may have to restart your shell for the changes to take effect.

Uninstall Azure CLI

[!INCLUDE uninstall-boilerplate.md]

Uninstall the CLI by directly deleting the files from the location chosen at the time of installation. The default install location is the user's home directory ($HOME).

  1. Remove the installed CLI files.

    rm -r <install location>/lib/azure-cli
    rm <install location>/bin/az
  2. Modify your $HOME/.bash_profile file to remove the following line:

    <install location>/lib/azure-cli/az.completion
    
  3. If using bash or zsh, reload your shell's command cache.

    hash -r

Remove data

[!INCLUDE remove-data-boilerplate.md]

Troubleshooting

Here are some common problems seen during a manual installation. If you experience a problem not covered here, file an issue on GitHub.

Install without Python 3

The Azure CLI has dropped support for Python 2.7 since version 2.1.0. On your system, there may be a Python version that predates the requirement of Python 3.6.x. Find a replacement python3 package.

curl "Object Moved" error

If you get an error from curl related to the -L parameter, or an error message including the text "Object Moved", try using the full URL instead of the aka.ms redirect:

curl https://azurecliprod.blob.core.windows.net/install | bash

az command not found

If you can't run the command after installation using bash or zsh, try clearing your shell's command hash cache and check if the problem is resolved.

hash -r

The issue can also occur if you didn't restart your shell after installation. Make sure that the location of the az command is in your $PATH. The location of the az command is ...

 <install path>/bin

Proxy blocks connection

[!INCLUDEconfigure-proxy]

In order to get the installation scripts, your proxy needs to allow HTTPS connections to the following addresses:

  • https://aka.ms/
  • https://azurecliprod.blob.core.windows.net/
  • https://pypi.python.org
  • Endpoints used by your distribution's package manager (if any) for core packages

[!INCLUDEtroubleshoot-wsl.md]