> ## Content Index
> Fetch the complete content index at: https://devopscube.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Setting Up Azure CLI on Ubuntu Linux
- URL: https://devopscube.com/setting-azure-cli-ubuntu-linux/
- Published: 2025-06-11T11:33:00.000Z
- Updated: 2025-06-11T12:54:39.000Z
- Author: devopscube
- Tags: AZURE, HOW TO GUIDES, cli, #Migrated-1741795015845, #wp, #wp-post, #Import 2025-03-12 15:57, #blog

Azure has a great web interface called azure portal for performing all the functions. But if you prefer command line tools over graphical user interface, you can make use of azure command line interface to manage all azure resources.

## Setting up Azure CLI on Ubuntu

This tutorial will guide you for setting up azure cli on Ubuntu Linux systems.

For this setup, we have used the following versions of the components,

1. Ubuntu 24.04
2. Sudo/root permission to execute the commands (Local workstation)
3. Azure user credentials

### Step 1: Install the required packages to install the Azure CLI 

Use the following command to install the packages

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

### Step 2: Install the singing Key

The official signing key will help verify the package

```
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
```

### Step 3: Add the Azure CLI Repository

Use the following command to add the repo files on the machine where you want to install the Azure CLI

```
AZ_DIST=$(lsb_release -cs)
echo "Types: deb
URIs: https://packages.microsoft.com/repos/azure-cli/
Suites: ${AZ_DIST}
Components: main
Architectures: $(dpkg --print-architecture)
Signed-by: /etc/apt/keyrings/microsoft.gpg" | sudo tee /etc/apt/sources.list.d/azure-cli.sources
```

### Step 4: Install the Azure CLI Package

Use the following command to install the Azure CLI on the Ubuntu machine

```
sudo apt-get update
sudo apt-get install azure-cli
```

### Step 5: Verify Installation

Once installed, verify the installation using the following command. 

```
az version
```

You will get a similar output

![The output of the azure cli version](https://storage.ghost.io/c/5f/2f/5f2f4d20-2abf-4534-8d40-7aa233aedd43/content/images/2025/06/image-33.png)

## Configuring CLI with Azure Subscription

To connect to your Azure subscription, you should configure your CLI for authentication. You can do this by executing the following command.

```
az login
```

This will open an interactive web page and prompt you to provide your Azure cloud user credentials, such as Mail ID and the Password.

Once you are done with it, you will see the confirmation in your command line as shown below.

![](https://storage.ghost.io/c/5f/2f/5f2f4d20-2abf-4534-8d40-7aa233aedd43/content/images/2025/06/image-35.png)

💡

If you want to authenticate the Azure CLI with the Azure Service Principle refer this blog --> [Authenticate Azure CLI Using Service Principal](https://devopscube.com/authenticate-azure-cli/)

### Adding Subscriptions

If you have different subscriptions with your Azure account, you can add a specific subscription for the CLI. To do that, get the subscription name using the following command.

```
az account list --output table

```

Add then, you can set a specific subscription using the following command.

```
az account set --subscription "<subscription-name-or-id>"

```

## Conclusion

The document covered the installation of the Azure CLI on an Ubuntu machine and authenticating with the user credentials.