az version: Report CLI and Extension Versions
az version prints the core Azure CLI version and the versions of all installed extensions.
When a command behaves differently between runners, version drift is the first suspect. az version captures exactly what the job is running.
What it does
az version returns a JSON object with azure-cli, azure-cli-core, azure-cli-telemetry, and an extensions map of every installed extension and its version. It is the canonical way to record the toolchain a job used.
Common usage
az version
# just the core CLI version
az version --query '"azure-cli"' -o tsv
# the containerapp extension version, if present
az version --query "extensions.containerapp" -o tsvSubcommands and flags
| Flag | What it does |
|---|---|
| --query '"azure-cli"' | Core CLI version (quote the hyphenated key) |
| --query extensions | Map of installed extensions to versions |
| -o tsv | Bare value for capture |
| -o json | Full structured version report |
In CI
Log az version early so failures are reproducible against a known toolchain. Pin the CLI image (for example a tagged mcr.microsoft.com/azure-cli) and pin extension versions with az extension add --version, then assert with az version that the job got what you expect.
Common errors in CI
Note the JMESPath quoting: the key azure-cli is hyphenated, so it must be quoted as '"azure-cli"' or the expression errors. An older az version may lack a subcommand you rely on; the fix is upgrading the CLI, not the command syntax. A missing extension simply yields an empty result under extensions.