Azure CLI
What it is
Azure CLI is Microsoft’s cross-platform command-line tool for working with Azure. Its commands start with az. You can run them interactively in a terminal or place them in scripts for repeatable administration and deployment tasks.
Why it exists
Clicking through a portal is useful for learning and investigation, but repeated work needs a recordable process. The CLI lets Northwind express a task as commands that can be reviewed, tested, versioned, and rerun with appropriate safeguards.
Key ideas
- Command groups reflect Azure tasks, such as
az group,az vm,az storage, andaz deployment. Useaz helpand current reference documentation rather than memorizing a long command list. - The CLI can run locally on Windows, macOS, and Linux, in a container, or in Cloud Shell. It is the tool, not the terminal program that hosts it.
- Authenticate with an appropriate method for the situation. An interactive human sign-in differs from a workload identity or service principal used by automation.
- The active subscription is part of command context. Set or verify it before any command that can change resources; a valid login can still point at the wrong subscription.
- JSON is the default output format. Other formats, such as a table for human reading, are available. Prefer machine-readable output for scripts and treat it as an interface that needs careful parsing.
How it fits (diagram)

Diagrams courtesy of Microsoft Learn / Azure docs: azure/cli/
Northwind example
Maya uses az to list the subscriptions she can access, deliberately selects Northwind production, and queries the resource group before a deployment. A pipeline uses a separate, least-privileged workload identity to deploy reviewed Bicep infrastructure. The team does not copy Maya’s interactive credentials into the pipeline or rely on a default subscription that might change between machines.
CLI versus portal and Cloud Shell
| Tool | Best starting use |
|---|---|
| Azure CLI | Scriptable, command-driven Azure work. |
| [[azure-portal | Azure portal]] |
| [[cloud-shell | Cloud Shell]] |
They use the same Azure authorization model. The chosen interface does not change what a user or workload is allowed to do.
Common confusion
- A command that succeeds has performed an Azure action; it is not merely a local preview unless its documentation says it is.
- CLI commands manage both control-plane resources and, in some cases, data-plane operations. Required permissions vary by command.
- A shell script is not automatically safe or idempotent. Handle existing resources, failures, retries, secrets, and the exact target scope deliberately.
Related
Path MOC · azure-vm · bicep · arm-template
Sources and re-audit
- Microsoft Learn — What is the Azure CLI?, checked 2026-09-16.