Azure CLI

The Azure CLI is a cross-platform command-line tool for managing Azure resources. It runs on Linux, macOS, and Windows, and can be used interactively or in automation scripts. This guide covers instal

Installation (2025)

Fedora / RHEL / CentOS

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo dnf install -y https://packages.microsoft.com/config/rhel/9.0/packages-microsoft-prod.rpm
sudo dnf install -y https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm
sudo dnf install azure-cli

Ubuntu / Debian

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

macOS (Homebrew)

brew update && brew install azure-cli

Windows

winget install -e --id Microsoft.AzureCLI

NixOS Installation & Configuration (2025)

Using Nix Package Manager

Apply the configuration:

Using Home Manager (per-user)

Apply the configuration:

Post-Install Configuration

  • Ensure you have Python 3 available (NixOS provides this by default).

  • If you need to use Azure CLI behind a proxy, set the HTTP_PROXY and HTTPS_PROXY environment variables as described above.

  • For persistent configuration, add proxy variables to your shell profile (e.g., .bashrc, .zshrc).


Proxy Settings

If you are behind a proxy, configure the following environment variables:


Running Azure CLI in Docker/Podman

To use your local SSH keys (for az ssh, az vm, etc.):


Real-Life DevOps Examples (2025)

1. Login and Set Subscription

2. Create a Resource Group

3. Deploy Infrastructure with Bicep

4. Assign a Managed Identity to a VM

5. Use Azure CLI in GitHub Actions


Azure CLI Jokes

Why did the Azure resource group break up with the VM? Because it needed more space!

Why do Azure engineers love the CLI? Because it's always az-y to automate!

Why did the Azure cloud get invited to all the parties? Because it always brings the best resources on demand!


More Examples & Resources


Tip: Use az upgrade to keep your CLI up to date!

Last updated