Configure Azure CLI locally in Linux Distribution (Ubuntu or Debian) and enjoy Commands.
Refer my earlier article here for basic understanding of Azure Cloud Shell (Bash).
To access the Azure CLI on a local Linux (Ubuntu distribution or Debian distribution) machine, simply install the Azure CLI on your computer and run it from the command line. This will give you access to all the same features and functionality as the web portal, but with the added convenience of being able to work directly from your local machine.
Let see what the procedure is or step by step instruction needed to set up the Azure CLI (Bash) in local Linux distribution machine. First let check if there exists any version earlier or not from the following command
az --version
The output confirms the azure cli (Bash) was not available earlier in the local Linux distribution machine. Now let see the step-by-step instructions to complete the installation for azure cli and there are 2 options for convenience.
Option 1:
Download the script using following command and send to the bash as shown below:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Option 2:
Update the system and get the packages for the installation
sudo apt-get update
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg
Download and install the key for Microsoft
sudo mkdir -p /etc/apt/keyrings
curl -sLS https://packages.microsoft.com/keys/microsoft.asc |
gpg --dearmor |
sudo tee /etc/apt/keyrings/microsoft.gpg > /dev/null
sudo chmod go+r /etc/apt/keyrings/microsoft.gpg
Include the Azure CLI repo
AZ_DIST=$(lsb_release -cs)
echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $AZ_DIST main" |
sudo tee /etc/apt/sources.list.d/azure-cli.list
Now update the machine again and install the CLI
sudo apt-get update
sudo apt-get install azure-cli
Now again verify the Azure CLI (Bash) is reflecting in the system as before
The Azure CLI version 2.58.0 has been successfully installed on the local system. Upon inspection, you may observe the installation of additional dependencies, as well as the default Python version 3.11.7.
How to Upgrade Azure CLI if already installed?
This following command updates all installed extensions as required.
az upgrade
That’s it, thank you for reading.
Happy to share this article to help you to explore new updates, do follow me, click the clap 👏 button below to show your valuable support.