Install Azure CLI 2.0 with yum

For Linux distributions with yum such as RHEL, Fedora, or CentOS, there's a package for the Azure CLI. This package has been tested with RHEL 7, Fedora 19 and higher, and CentOS 7.

Note

To install the CLI, you need the following software:

Install

  1. Import the Microsoft repository key.

    sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
    
  2. Create local azure-cli repository information.

    sudo sh -c 'echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /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 sign in, use az login command.

  1. Run the login command.

    az login
    

    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.

  2. Sign in with your account credentials in the browser.

To learn more about different authentication methods, see Sign in with Azure CLI 2.0.

Update

Update the Azure CLI with the yum update command.

sudo yum update azure-cli

Uninstall

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.

  1. Remove the package from your system.

    sudo yum remove azure-cli
    
  2. If you don't 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
    

Next Steps

Now that you've installed the Azure CLI, take a short tour of its features and common commands.