Installing the Azure CLI depends on the platform that we're using.
For Windows, we need to download the installer from https://aka.ms/installazurecliwindows and simply run the installer like so:
To install it on macOS, we need to run this command:
brew update && brew install azure-cli
Installing on Linux depends on the distribution. For example, on a distribution with yum (such as RHEL or CentOS), we need to run three commands.
First, we import the Microsoft repository key:
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
Second, we create the repository information:
sudo sh -c 'echo -e "[azure-cli] name=Azure CLI baseurl=https://packages.microsoft.com/yumrepos/azure-cli enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
Finally, we run the installation:
sudo yum install azure-cli
Installation may depend on the platform, but after the installation process has completed, running Azure CLI commands is the same on all platforms. To log in to Azure with the Azure CLI, we need to run this:
az login
This will display a message (shown here) and open a new browser session, where you need to authorize access to Azure:
All commands in the Azure CLI start with az. To get more information, you can run this:
az --help
You will get the following output:
You can combine --help with any of the commands in the list to get more information on a specific command.