LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

az

Unified command-line interface for Microsoft Azure

TLDR

Login to Azure
$ az login
copy
List resource groups
$ az group list
copy
Create resource group
$ az group create --name [MyResourceGroup] --location [eastus]
copy
List virtual machines
$ az vm list
copy
Get account information
$ az account show
copy
Use specific subscription
$ az account set --subscription [subscription-id]
copy

SYNOPSIS

az [group] [subgroup] [command] [options]

DESCRIPTION

az is the unified command-line interface for Microsoft Azure. It provides access to Azure services including virtual machines, storage, databases, Kubernetes, and hundreds of other cloud resources through a consistent cross-platform interface.The CLI enables automation, scripting, and management of Azure resources without using the web portal.

PARAMETERS

--output, -o format

Output format (json, jsonc, table, tsv, yaml, none)
--query
JMESPath query to filter output
--subscription id
Subscription name or ID
--resource-group, -g name
Resource group name
--location, -l region
Azure region
--verbose
Increase logging verbosity
--debug
Enable debug logging
--only-show-errors
Only show errors

CONFIGURATION

~/.azure/config

INI-format configuration file for defaults and settings. Sections include [core], [defaults], and [cloud]. Managed via `az config set`.
$ # Set default output format
az config set core.output=table

# Set default location
az config set defaults.location=eastus
copy

COMMON SERVICES

- vm - Virtual machines- storage - Storage accounts- aks - Azure Kubernetes Service- webapp - Web apps- sql - SQL databases- cosmosdb - Cosmos DB- keyvault - Key Vault- network - Networking resources- group - Resource groups- account - Account management

CAVEATS

Requires an active Azure subscription and prior `az login`. Some operations are destructive and have no undo. API throttling can affect large bulk scripts. New Azure services may take weeks or months to gain full CLI parity. Prefer --query with JMESPath over piping through shell tools for reliable scripting.

HISTORY

The Azure CLI 2.0 was released by Microsoft in 2017 as a complete rewrite of the original Azure CLI, built in Python with focus on usability and cross-platform support.

SEE ALSO

Copied to clipboard
Kai