Install Azure CLI 2.0 with yum

If you are running a distribution that comes with yum, such as RHEL, Fedora, or CentOS, there is a package available for the Azure CLI. This package has been tested with RHEL 7, Fedora 19 and higher, and CentOS 7.


To install the CLI, your distribution must have packages with the following software:


  1. Import the Microsoft repository key.

    sudo rpm --import
  2. Create local azure-cli repository information.

    sudo sh -c 'echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=\nenabled=1\ngpgcheck=1\ngpgkey=" > /etc/yum.repos.d/azure-cli.repo'
  3. Install with the yum install command.

    sudo yum install azure-cli

You can then run the Azure CLI with the az command. To log in, run the az login command.

az login

To learn more about different login methods, see Log in with Azure CLI 2.0.


Update the Azure CLI with the yum update command.

sudo yum update 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 information about why you chose to uninstall and how the CLI could be improved. Our goal is to make the Azure CLI bug-free and user-friendly. If you encountered a bug, we'd appreciate it if you file a GitHub issue.

  1. Remove the package from your system.

    sudo yum remove azure-cli
  2. If you do not plan to reinstall the CLI, remove the repository information.

    sudo rm /etc/yum.repos.d/azure-cli.repo
  3. If you removed the repository information, also remove the Microsoft GPG signature key.

    MSFT_KEY=`rpm -qa gpg-pubkey /* --qf "%{version}-%{release} %{summary}\n" | grep Microsoft | awk '{print $1}'`
    sudo rpm -e --allmatches gpg-pubkey-$MSFT_KEY