First we execute the following to refresh the available packages from all the repositories:
sudo apt-get update
We install the necessary packages for Azure CLI (azure-cli):
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg -y
We download and install the Microsoft signature key using the /etc/apt/keyrings folder that a priori should exist:
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
Add the Azure CLI software repository by running:
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" |
sudo tee /etc/apt/sources.list.d/azure-cli.list
When adding the new repository we update the information of the available packages by executing again:
sudo apt-get update
We run the following command to see the available Azure CLI versions:
apt-cache policy azure-cli
which will give us something like:
operatorfeitam@pc-windows10:~$ apt-cache policy azure-cli
azure-cli:
Installed: (none)
Candidate: 2.46.0-1~jammy
Version table:
2.46.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main amd64 Packages
2.45.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.44.1-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.44.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.43.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.42.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.41.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.40.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.39.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.38.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.37.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
2.36.0-1~jammy 500
500 https://packages.microsoft.com/repos/azure-cli jammy/main all Packages
operatorfeitam@pc-windows10:~$
If we want to install the latest version of the azure-cli package, we execute:
sudo apt-get install azure-cli -y
And if we want to install a specific version, for example, '2.43.0-1~jammy' we execute:
sudo apt-get install azure-cli=2.43.0-1~jammy -y
We check the installed version with:
az -v
which gives us in this case:
operatorfeitam@pc-windows10:~$ az -v
azure-cli 2.46.0
core 2.46.0
telemetry 1.0.8
Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1
Python location '/opt/az/bin/python3'
Extensions directory '/home/operatorfeitam/.azure/cliextensions'
Python (Linux) 3.10.10 (main, Mar 6 2023, 09:39:14) [GCC 11.3.0]
Legal docs and information: aka.ms/AzureCliLegal
Unable to check if your CLI is up-to-date. Check your internet connection.
operatorfeitam@pc-windows10:~$