UbuntuUbuntu Based

How To Install Azure CLI on Ubuntu 24.04 LTS

In this tutorial, we will show you how to install Azure CLI on Ubuntu 22.04 LTS. Azure CLI is a set of commands used to manage Azure resources. It’s designed to make scripting easy, automate tasks, and manage Azure resources in a straightforward manner. Azure CLI is open-source and available on GitHub, which means it’s continually updated and improved by the community.

The benefits of using Azure CLI are numerous. It provides a unified scripting experience, and it’s optimized for managing and administering Azure resources from the command line. It also offers a clean syntax, rich expression capabilities, and comprehensive command details, making it a preferred choice for many developers.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Azure CLI on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • Basic knowledge of the Linux command-line interface (CLI). This guide assumes you’re comfortable with executing commands in a terminal.
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Azure CLI.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Azure CLI on Ubuntu 24.04 LTS Jammy Jellyfish

Step 1. Before installing Azure CLI, it‘s essential to update the system packages. This ensures that you have the latest versions of all packages and their dependencies. Open a terminal and run the following command:

sudo apt update
sudo apt upgrade

Next, install the necessary packages with the following command below:

sudo apt install ca-certificates curl apt-transport-https lsb-release gnupg

Step 2. Installing Azure CLI on Ubuntu 22.04.

With the necessary packages installed, you can now proceed to install Azure CLI. First, download and install the Microsoft signing key with the following command:

curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null

Next, add the Azure CLI software repository. This repository contains the package files for Azure CLI. Use the following command to add the repository:

echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/azure-cli.list

Finally, install Azure CLI using the apt package manager. Run the following command to install Azure CLI:

sudo apt update
sudo apt install azure-cli

After installing Azure CLI, verify the installation by checking the Azure CLI version. Run the following command to display the version:

az --version

If a newer version of Azure CLI is available, you can update it using the apt package manager. Run the following commands to update Azure CLI:

sudo apt update
sudo apt upgrade azure-cli

Step 3. Logging into Azure from CLI.

With Azure CLI installed and updated, you can now log into your Azure account. Run the following command to initiate the login process:

az login

This command opens a new browser window where you can complete the authentication process. If you’re running Azure CLI on a remote server, you can use the device code displayed in the terminal to authenticate on another device.

Azure CLI offers a wide range of commands for managing Azure resources. Here are some common commands and their uses:

  • az group create: Creates a new resource group.
  • az vm create: Creates a new virtual machine.
  • az storage account create: Creates a new storage account.

Congratulations! You have successfully installed Azure CLI. Thanks for using this tutorial for installing Azure CLI on the Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official Azure CLI website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button