Azure CLI Global Options Guide | Generated by AI
Question: Provide a comprehensive introduction to Azure CLI command line options.
Answer:
The Azure CLI (az) is a cross-platform command-line tool for managing Azure resources. Almost every command supports a set of global arguments (also called global parameters or global options) that work across nearly all commands.
These global options are the most frequently used “command line options” when people talk about Azure CLI usage patterns.
Most Important Global Arguments (2026)
These arguments can be appended to almost any az command:
| Argument | Short | Common values / Description | Typical use case |
|---|---|---|---|
--help |
-h |
Show help for the command / group | Learn any command: az vm create -h |
--output |
-o |
json (default), jsonc, table, tsv, yaml, yamlc, none |
Human-readable: --output tableMachine: --output json |
--query |
JMESPath expression | Filter output: --query "[].{name:name, id:id}" |
|
--subscription |
Subscription name or ID | Override default: --subscription "Prod Sub" |
|
--verbose |
Increase logging verbosity | See more details during execution | |
--debug |
Show all debug logs + low-level REST API calls | Troubleshooting / deep debugging | |
--only-show-errors |
Suppress warnings, show only errors | Clean CI/CD output |
Quick examples:
# Human-friendly table output
az resource list --output table
# Filter to only names and locations
az vm list --query "[].{Name:name, Location:location}" --output table
# Run command in a specific subscription
az group list --subscription "My-Dev-Sub" -o table
# Debug a failing command
az storage account create ... --debug
Other Useful Global / Frequently Encountered Options
-
--resource-group/-g
Very common positional-style argument (not strictly global, but appears in hundreds of commands) -
--name/-n
Resource name (very common) -
--ids
Accepts one or more Azure Resource IDs instead of requiring--resource-group --name ... -
--yes/-y
Auto-answer “yes” to confirmation prompts (great for automation) -
--no-wait
Do not wait for long-running operations to complete (fire-and-forget) -
--wait(some commands)
Wait until operation finishes and show final status
Configuration that Affects Command-line Behavior
Many behaviors can be set once (instead of repeating flags every time) using:
# Interactive wizard (recommended for beginners)
az init
# Or set individual values
az config set core.output=table
az config set core.default_subscription="My-Sub-Name"
az config set logging.enable_log_file=true
Common config keys that influence command-line feel:
core.output→ default output formatcore.only_show_errors→ like permanent--only-show-errorscore.no_color→ disable ANSI colorscore.collect_telemetry→ opt out of telemetrycore.default_subscription/core.default_resource_group/core.default_location
Positional vs Named Arguments
Azure CLI uses two styles:
- Named (most common):
--resource-group myRg --name myVm - Positional (less common, but exists): some very old commands or extensions
Always prefer named arguments for clarity and script robustness.
Best Practices Summary (2026 style)
- Use
--output tableinteractively - Use
--output json+--queryin scripts / CI/CD - Prefer
--idswhen scripting with resource IDs - Chain
--only-show-errorsin pipelines - Use
az configoraz initto reduce typing - Always check help:
az <group> <command> -h
The full list of global parameters is shown when you run az --help or any command with --help.
References:
- Get started with Azure CLI - Global arguments
- Azure CLI global parameters
- Azure CLI configuration options
- Azure CLI reference index