Install the Azure CLI¶
To install the Azure CLI, follow the instructions in the Azure CLI documentation.
After installing the CLI, you can execute the az
command:
az --version
# ...
# azure-cli 2.24.0
# ...
Create the az alias when using Docker¶
The installation instructions expect that you run the az
command from the current directory.
Therefore, you need to create an alias, when using the dockerized Azure CLI.
Copy the script to an executable file in your path, for example
~/bin/az
:#!/usr/bin/env bash set -eu command="$@" docker run --rm --volume `pwd`:/root \ --volume $HOME/.azure:/root/.azure \ -w=/root mcr.microsoft.com/azure-cli \ az $command
Make sure that you can call it using
az
(the folder~/bin
needs to be in your$PATH
). This enables you to executeaz
when using the dockerized Azure CLI.Log in again to continue with the next step:
az login