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
- Download the Azure CLI installer.
- 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 Linux, Red Hat Linux, Fedora Linux, Amazon Linux, Alma Linux, Rocky 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 Linux, Mint Linux, Kali Linux, Kubuntu 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