LinuxCommandLibrary

az

Manage Azure cloud resources

TLDR

Log in to Azure

$ az login
copy

Manage azure subscription information
$ az account
copy

List all Azure Managed Disks
$ az disk list
copy

List all Azure virtual machines
$ az vm list
copy

Manage Azure Kubernetes Services
$ az aks
copy

Manage Azure Network resources
$ az network
copy

Start in interactive mode
$ az interactive
copy

Display help
$ az --help
copy

SYNOPSIS

az [--version] [--help | -h] [--output (-o)] [--query (-q)] [--subscription] [--debug] [--verbose] [group] [command] [arguments]

PARAMETERS

--debug
    Increase logging verbosity to show all debug logs.
Default: False

--help -h
    Show this help message and exit.

--output -o
    Output format.
Accepted values: json, jsonc, table, tsv, yaml, yamlc.
Default: json

--query -q
    JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription
    Name or ID of subscription. Configures default via az account set -s NAME_OR_ID.

--verbose
    Increase logging verbosity.

--version
    Show version of installed CLI and extensions.

group
    Top-level group like account, group, vm, storage.

command
    Subcommand under the group, e.g., az vm list.

arguments
    Group- or command-specific arguments and flags.

DESCRIPTION

The az command is the entry point for the Azure Command-Line Interface (Azure CLI), Microsoft's official tool for managing Azure cloud resources from the terminal. It supports creating, updating, deleting, and querying services like virtual machines, storage accounts, databases, and more across all Azure regions.

Azure CLI uses a hierarchical structure: az <group> <command> [options]. For example, az vm create --resource-group myRG --name myVM --image Ubuntu2204 --admin-username azureuser --ssh-key-value ~/.ssh/id_rsa.pub provisions a VM.

Key strengths include JSON output with JMESPath querying for scripting, tab autocompletion, extensibility via az extension commands, and cross-platform support (Linux, macOS, Windows). It's ideal for automation in CI/CD pipelines, Bash/PowerShell scripts, or Docker. No GUI needed—fully programmatic control.

Requires installation and authentication via az login. Supports multiple accounts, subscriptions, and output formats like table for readability. Version 2.x emphasizes Bash/PowerShell integration over older Node.js-based xplat-cli.

CAVEATS

Requires internet for API calls; authenticate first with az login. Not all features available offline. Large outputs may need --query or piping to jq(1). Rate limits apply to Azure API.

AUTHENTICATION

Use az login for interactive browser login, az login --service-principal for apps, or az login --identity for managed identities.
Switch: az account set -s <id>.

INSTALLATION ON LINUX

Debian/Ubuntu: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash.
RHEL/CentOS: rpm --import https://packages.microsoft.com/keys/microsoft.asc && ... (see docs).
Update: az upgrade.

EXTENSIONS

Extend with az extension add --name <name>, e.g., azure-devops, ai. List: az extension list.

HISTORY

Released March 2017 by Microsoft as Azure CLI 2.0, replacing Node.js-based xplat-cli (2013). Python-based for better scripting. Reaches version 2.60+ by 2024, with ongoing additions for AI/ML services like Azure OpenAI.

SEE ALSO

jq(1), curl(1), ssh(1)

Copied to clipboard