Azure CLI
Official command-line interface for Microsoft Azure
Description
The Azure CLI is the cross-platform command-line tool for managing Azure resources. It provides commands for virtually every Azure service including VMs, storage, networking, databases, Kubernetes, and serverless functions, with consistent syntax and rich query capabilities.
Install
brew install azure-clipip install azure-cliAI Summary
Official Azure CLI. Manage VMs, storage accounts, AKS clusters, App Services, Azure Functions, and the full breadth of Microsoft Azure services from the terminal.
Capabilities
- + Create and manage virtual machines, scale sets, and networking
- + Deploy web apps to Azure App Service
- + Manage AKS Kubernetes clusters and container instances
- + Provision and query Azure SQL, Cosmos DB, and other databases
- + Manage storage accounts, blobs, and file shares
- + Configure Azure Active Directory and role-based access control
- + Query output with built-in JMESPath --query support
Use When
- → Managing any Microsoft Azure resource from the terminal
- → Deploying applications to Azure App Service, Functions, or AKS
- → Automating Azure resource provisioning in CI/CD pipelines
- → Scripting multi-resource deployments with Azure
Avoid When
- x Managing non-Azure cloud resources (use aws-cli, gcloud, doctl instead)
- x Need declarative infrastructure management (use Terraform or Bicep)
- x Building simple static sites without Azure dependency (use Vercel or Netlify)
Usage Patterns
Create a virtual machine
az vm create -g myResourceGroup -n myVM --image Ubuntu2204 --admin-username azureuser --generate-ssh-keys Creates an Ubuntu VM with auto-generated SSH keys in the specified resource group
Deploy a web app
az webapp up --name my-app --resource-group myRG --runtime 'NODE:18-lts' Creates and deploys a web app from the current directory
List resources in a group
az resource list -g myResourceGroup --output table Lists all resources in a resource group in table format
Input / Output
0 Success 1 Error Typical Pipelines
az vm list --output json | jq '.[] | {name, powerState: .powerState}' az group list --query '[].name' -o tsv | fzf | xargs -I{} az resource list -g {} -o table az monitor activity-log list --offset 1h --query "[?level=='Error']" -o json | jq -r '.[].operationName.value' Related Tools
aws-cli is the equivalent CLI for Amazon Web Services
gcloud is the equivalent CLI for Google Cloud Platform
Terraform for declarative multi-cloud infrastructure, az for imperative Azure commands
jq processes JSON output from Azure CLI for complex transformations