How to install Azure CLI on Windows, Mac, and Linux?

First published: | Last updated:

Learn how to install the Azure CLI on Windows, Mac, and Linux operating systems to manage Azure cloud resources effectively.


What is Azure CLI?

The Azure CLI is a cross-platform command-line tool to connect to the Azure cloud and execute administrative commands on Azure resources. It allows the execution of commands through a terminal using interactive command-line prompts or a script.

Install Azure CLI

Installing the Azure CLI on your Windows, Mac, or Linux operating system enables you to manage and operate various Azure resources directly from your terminal with ease. Once the installation is complete, it is important to verify that everything was installed successfully by checking the version of the Azure CLI. For more detailed information, you can refer to the official Azure CLI documentation.

Windows

  1. Download the Azure CLI installer.
  2. Execute the Azure CLI installer, and proceed with Next and Finish prompts to install Azure CLI.

After installing Azure CLI on your Windows operating system, you’ll want to verify the installation by using the following commands.

# Check Azure CLI version.
$ az --version

# Login to Azure cloud via Azure CLI.
$ az login --use-device-code

Mac (Homebrew)

You can use the following commands to install Azure CLI in the Homebrew-based Mac operating system.

# Install Azure CLI.
$ brew install azure-cli

# Check Azure CLI version.
$ az --version

# Login to Azure cloud via Azure CLI.
$ az login --use-device-code

Linux (RPM)

You can use the following commands to install Azure CLI in RPM-based Linux operating systems such as CentOS LinuxRed Hat LinuxFedora LinuxAmazon LinuxAlma LinuxRocky Linux, etc., or any other similar equivalents.

# Add Microsoft official GPG key to package manager.
$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

# Add Microsoft repository to package manager source list.
$ sudo yum install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm

# Install Azure CLI.
$ sudo yum install azure-cli

# Check Azure CLI version.
$ az --version

# Login to Azure cloud via Azure CLI.
$ az login --use-device-code

Linux (Debian)

You can use the following commands to install Azure CLI in Debian-based Linux operating systems such as Ubuntu LinuxMint LinuxKali LinuxKubuntu Linux, etc., or any other similar equivalents.

# Install Azure CLI.
$ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

# Check Azure CLI version.
$ az --version

# Login to Azure cloud via Azure CLI.
$ az login --use-device-code
Logo of SloopStash organization.

What's next? Let's connect to meet your IT demands.

Products Toolkits Solutions Training


Experience business-class software products, open source toolkits, technology solutions, and training, designed with cybersecurity, automation, and AI in mind.