How to Install Azure CLI on Linux - Quick Guide

How to Install Azure CLI on Linux

Simple 3-Step Installation Guide

📅 Published: October 21, 2025 | ⏱️ 4 min read | 🏷️ Azure, Linux, Cloud Computing

Azure CLI (Command Line Interface) is Microsoft's cross-platform command-line tool that enables you to manage Azure resources directly from your terminal. Whether you're deploying virtual machines, managing storage accounts, or configuring networking, Azure CLI provides a powerful and efficient way to interact with your Azure infrastructure.

In this guide, we'll walk through a quick and straightforward process to install Azure CLI on any Debian/Ubuntu-based Linux distribution.

Why Use Azure CLI?

  • Automation: Script and automate Azure resource management tasks
  • Efficiency: Execute commands faster than using the Azure portal
  • Cross-Platform: Works on Linux, macOS, and Windows
  • Integration: Easy to integrate with CI/CD pipelines and DevOps workflows

Prerequisites

Before we begin, make sure you have:

  • A Linux system running Ubuntu, Debian, or similar distribution
  • Terminal access with sudo privileges
  • Internet connection for downloading packages
  • An active Microsoft Azure account (for using Azure CLI)
💡 Tip: This installation method uses Microsoft's official installation script, which automatically handles all dependencies and repository configuration.

Installation Steps

Step 1: Update Package Lists

First, update your system's package lists to ensure you have the latest package information:

sudo apt update

This command refreshes the list of available packages and their versions from all configured repositories. It's always a good practice to run this before installing new software.

Step 2: Run Azure CLI Installation Script

Execute Microsoft's official installation script to install Azure CLI:

sudo curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Let's break down what this command does:

  • curl -sL: Downloads the installation script silently and follows redirects
  • https://aka.ms/InstallAzureCLIDeb: Microsoft's official Azure CLI installation script URL
  • | sudo bash: Pipes the downloaded script to bash for execution with sudo privileges

The script will automatically:

  • Add Microsoft's package repository to your system
  • Install required dependencies
  • Download and install the latest version of Azure CLI
  • Configure everything needed to start using Azure CLI
⚠️ Note: The installation process may take a few minutes depending on your internet connection speed. You'll see progress messages in your terminal.

Step 3: Verify Installation

Confirm that Azure CLI has been installed successfully by checking its version:

az --version

If the installation was successful, you should see output similar to:

azure-cli 2.xx.x core 2.xx.x telemetry 1.x.x Dependencies: msal 1.xx.x azure-mgmt-resource xx.x.x Python location '/opt/az/bin/python3' Extensions directory '/home/user/.azure/cliextensions' Python (Linux) 3.xx.x (default, ...) ...

This output displays the installed version of Azure CLI along with information about its core components, dependencies, and Python installation.

Post-Installation: Login to Azure

Now that Azure CLI is installed, you can log in to your Azure account:

az login

This command will:

  1. Open your default web browser
  2. Prompt you to sign in with your Azure credentials
  3. Display your available Azure subscriptions in the terminal
💡 Alternative Login Method: If you're on a headless server or VM without browser access, use az login --use-device-code for device code authentication.

Quick Test Commands

Try these basic commands to test your Azure CLI installation:

List all subscriptions:

az account list --output table

List all resource groups:

az group list --output table

Check your current subscription:

az account show --output table

Complete Installation Script

Here's the complete installation script with all three commands:

sudo apt update sudo curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash az --version

Updating Azure CLI

To update Azure CLI to the latest version in the future, simply run:

sudo apt update && sudo apt upgrade azure-cli

Troubleshooting

Issue: Command not found after installation

Try closing and reopening your terminal, or run:

source ~/.bashrc

Issue: Permission denied

Make sure you're using sudo for the installation commands and that your user has sudo privileges.

Conclusion

Congratulations! You've successfully installed Azure CLI on your Linux system in just three simple steps. You can now manage your Azure resources efficiently from the command line, automate cloud infrastructure tasks, and integrate Azure into your DevOps workflows.

For comprehensive documentation on Azure CLI commands and usage, visit the official Microsoft Azure CLI Documentation.

💡 Next Steps: Explore Azure CLI commands, learn about Azure Resource Manager, and discover how to automate your cloud infrastructure with scripts and templates.
✅ Pro Tip: Use az find to search for Azure CLI commands, and az [command] --help to get detailed help for any command.

© 2025 Azure CLI Installation Guide | Made with ☁️ for Cloud Engineers

Comments

Popular posts from this blog