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 command subcommand [options]

Examples:
`az login`
`az group create --name myResourceGroup --location eastus`
`az vm list --output table`
`az webapp up --name myWebApp --resource-group myResourceGroup`

PARAMETERS

--help, -h
    Shows help message for a command or subcommand.

--output, -o
    Output format: 'json', 'jsonc' (colorized JSON), 'tsv' (tab-separated values), 'table', 'yaml', 'yamlc', or 'none'. Default is 'json'.

--query
    JMESPath query string for filtering the output of Azure CLI commands.

--verbose
    Increases logging verbosity to show verbose logs.

--debug
    Increases logging verbosity to show all debug logs.

--version
    Shows the version of the Azure CLI.

--only-show-errors
    Suppresses warnings and only shows errors.

--subscription
    Name or ID of the subscription to use for the command.

--tenant
    Tenant ID to use for login or operations (often used in multi-tenant scenarios).

--no-browser
    Do not launch a web browser for interactive login. Forces device code authentication flow.

DESCRIPTION

The `az` command is the Azure Command-Line Interface (Azure CLI), a powerful and cross-platform tool developed by Microsoft for managing Azure resources and services directly from your terminal. It provides a rich set of commands to interact with almost every aspect of Azure, from creating and configuring virtual machines, storage accounts, and networking components to managing databases, web apps, and serverless functions.

Designed for efficiency, `az` allows for both interactive usage and seamless integration into automation scripts and and DevOps pipelines. Its consistent command structure and intuitive syntax make it accessible to developers and administrators alike. Built on Python, the Azure CLI is extensible through various extensions, enabling it to support new or specialized Azure services as they emerge, offering a flexible and comprehensive management solution for the Azure cloud.

CAVEATS

Managing resources with `az` requires an active Azure subscription and successful authentication via `az login`. Commands are executed against your cloud resources, meaning actions like deletion are permanent. Users should exercise caution, especially in production environments. Internet connectivity is mandatory for all operations. The hierarchical nature of commands can initially present a learning curve, but the built-in help (`az --help`) is extensive and highly useful for navigation.

AUTHENTICATION

Before using `az` to manage resources, you must authenticate to Azure. This is typically done using `az login`. This command opens a web browser for interactive sign-in or provides a device code for browser-less environments. Once authenticated, `az` maintains your session.

EXTENSIONS

The Azure CLI supports extensions, which are components that add new commands or functionality. Extensions allow the CLI to support preview services or provide specialized features without requiring a full CLI update. They can be installed and managed using `az extension` commands (e.g., `az extension add --name azure-devops`).

INTERACTIVE MODE

For users new to the Azure CLI or for exploring commands, `az interactive` provides an enhanced interactive shell experience with autocompletion, command descriptions, and examples. It greatly aids in discovering and learning `az` commands.

HISTORY

The Azure CLI (also known as az CLI) was developed by Microsoft as a modern, cross-platform command-line tool for managing Azure resources. It was introduced around 2016-2017, succeeding the older Node.js-based Azure Service Management (ASM) CLI (often referred to as Azure CLI v1). The primary goal was to provide a consistent, Python-based CLI that runs natively on Windows, macOS, and Linux, offering a more robust and flexible experience.

Since its inception, `az` has undergone continuous development, with frequent updates to support new Azure services and features, making it the primary and recommended command-line interface for Azure cloud management today. Its design emphasizes automation, scripting, and integration into CI/CD pipelines.

SEE ALSO

azure-powershell (PowerShell module for Azure), aws cli (Amazon Web Services CLI), gcloud (Google Cloud CLI), kubectl(1) (Kubernetes command-line tool, often used with Azure Kubernetes Service), jq(1) (Command-line JSON processor, useful for `az` output)

Copied to clipboard