az extension add: Install CLI Extensions
az extension add installs an Azure CLI extension so its command group becomes available.
Newer command groups ship as extensions. Pinning and pre-installing them in CI avoids interactive install prompts and version drift between runs.
What it does
az extension add downloads and installs an extension (such as containerapp, ml, or aks-preview), adding its command group to the CLI. Without it, az auto-prompts to install on first use, which stalls a non-interactive job.
Common usage
az extension add --name containerapp --upgrade
# pin a version for reproducible CI
az extension add --name containerapp --version 0.3.49
# allow unattended dynamic installs globally
az config set extension.use_dynamic_install=yes_without_promptSubcommands and flags
| Flag | What it does |
|---|---|
| --name, -n | Extension to install |
| --upgrade | Install or upgrade to the latest version |
| --version | Pin a specific extension version |
| --source | Install from a wheel URL or path |
| --allow-preview | Permit preview extension versions |
In CI
Pre-install required extensions at the top of the job with a pinned --version so runs are reproducible and never block on an install prompt. Alternatively set extension.use_dynamic_install=yes_without_prompt so first use installs silently. Pinning beats auto-install when you need a stable surface.
Common errors in CI
"The command requires the extension <x>. Do you want to install it now? (Y/n):" hanging means a non-interactive job with no dynamic install configured; pre-install or set the config flag. "No matching extensions for '<name>'" means a wrong name or a removed extension. A version conflict means an incompatible extension and core CLI pairing; upgrade the core CLI.