DEV Community

Cover image for Azure-cli: Installing the tool on Linux
romerito
romerito

Posted on

Azure-cli: Installing the tool on Linux

This post is the beginning of a series of others in which we will talk about Azure Cli. This tool is a command line interface in which one can manage microsoft azure resources.
My current linux is that.

romerito@dev:~$ cat /etc/os-release | head -3

NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
Enter fullscreen mode Exit fullscreen mode

My OS as you can see is PopOS which was built based on the ubuntu/debian architecture, so we will use the APT package manager (Advanced package tool).
There are several ways to install the program, but we have chosen the method of setting up the repository on our own machine.
First we will update our distro using this command:

romerito@dev:~$ sudo apt-get update\
&& sudo apt-get install ca-certificates\
curl\ 
apt-transport-https lsb-release\
gnupg
Enter fullscreen mode Exit fullscreen mode

Now we need to use the gpg utility to authorize external repositories via apt.
but the utility only accepts GPG files, and in this case we need to convert from KEY to GPG, this is possible by passing the --dearmor flag after that we can add the repository link to the package source list.

romerito@dev:~$ curl -sL https://packages.microsoft.com/keys/microsoft.asc |
    gpg --dearmor |
    sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null
Enter fullscreen mode Exit fullscreen mode

And finally we add the repository

romerito@dev:~$ AZ_REPO=$(lsb_release -cs) &&
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" |
    sudo tee /etc/apt/sources.list.d/azure-cli.list
Enter fullscreen mode Exit fullscreen mode

After that, we update the system again and install the package

romerito@dev:~$ sudo apt-get update &&
sudo apt-get install azure-cli
Enter fullscreen mode Exit fullscreen mode

Ready! now if you type the command az in the terminal we will have this.

Image description

In the next post we will link cli to our microsoft azure account, see you later.

Top comments (0)