ערוך

שתף באמצעות


Azure CLI onboarding cheat sheet

If you're looking to onboard quickly with the Azure CLI, you have come to the right place! Use this page to learn tips and techniques when getting started with the Azure CLI.

Content indexes

Jump straight to reference command examples, sample scripts, and tutorials using these links:

Getting started

Question Answer Learn more
What advantage is there to using Azure CLI? You can manage multiple Azure resources concurrently from a flexible command-line. For example, create 50 Azure storage accounts, or update multiple user permissions through a script. Choose the right command-line tool
Where can I run the Azure CLI? The Azure CLI runs in Windows (Cmd or PowerShell), Linux, macOS, Docker containers, and Azure Cloud Shell. Using Azure Cloud Shell is the quickest way to get started. Run Azure Cloud Shell
Do I have to install the Azure CLI? Azure Cloud Shell and some Linux distributions have the Azure CLI preinstalled. For all other environments, you must install the Azure CLI. Install the Azure CLI
How do I run the Azure CLI in a Docker container? docker run -it mcr.microsoft.com/azure-cli How to run the Azure CLI in a Docker container
What URLs do I need for proxy bypass? This depends on the Cloud you are using. For a complete list see the list of endpoints needed for proxy bypass. Azure CLI endpoints for proxy bypass
How do I sign in? Use az login inside your console window. Use your own Azure username and password, a service principal, managed identity or WAM. Sign in with Azure CLI

Using reference commands

Question Answer Learn more
What is the Azure CLI syntax pattern? "command group + command subgroup + command + --parameters" Example: "az storage account create --name myStorageAccount" Azure CLI syntax components.
What is the difference between a command group, cmdlet, command, alias, module, and reference? Good question! The Azure CLI only has command groups, reference commands, and user-defined aliases. You may be thinking of Azure PowerShell if you are looking for cmdlets and modules. Azure CLI syntax components.
What is an extension and why does it have to be installed separately? Extensions are command group add-ins that are not shipped as part of the core Azure CLI. You are prompted to install an extension the first time you use it. Get a list of available extensions by running az extension list-available -output table. Use and manage extensions with the Azure CLI
How do I get a list of all commands, both core and extension? For a list of command groups, in your console type az and Enter. For a list of subgroups and commands, use the --help parameter. Example: az account --help or az account subscription --help outputs a command list for just the group or subgroup. Reference index A-Z
Does the Azure CLI have tab completion? Yes! When typing a command in PowerShell, press your Tab key. This feature is only available in PowerShell. Enable Tab Completion on PowerShell
How do I get in-line help? Every command has a --help parameter that results in descriptions and tips to display in your console. Example: az account ---help or az vm create --help You can also Request support.
How can I learn to use multiple reference commands to complete a single job to be done? We're glad you asked! The Azure CLI provides several interactive commands that provide syntax and next steps. In the next section, learn about az interactive, az scenario, az next, and az find. Learning Azure CLI

For a side-by-side comparison of Azure CLI and Azure PowerShell syntax, see Azure CLI vs Azure PowerShell: Side-by-side Command Comparison.

See script comparisons between Bash, PowerShell, and Cmd in Learn Azure CLI syntax differences in Bash, PowerShell and Cmd.

Learning Azure CLI

The Learn to use the Azure CLI tutorial walks you through many common Azure CLI tasks with examples in Bash, PowerShell and Cmd. Here are some of the skills covered while working with Azure Storage:

There are also several reference commands that provide interactive prompts to help you learn the Azure CLI.

Command Description Example
az interactive In a PowerShell console, get auto-completion, command descriptions, and examples as you type. See Work in interactive mode for more information. Example: Type az interactive in your console window then Enter.
az scenario Get end to end (E2E) examples and execute them with walk-through prompts. Type az scenario guide "keywords of interest" in your console then Enter. The Azure CLI returns scenarios based on your keyword(s). Example: az scenario guide "virtual machines"
az next Get recommendations for the next Azure CLI command based on customer execution patterns. You are prompted to select a command path. Type az next in your console then Enter. Pick from 1 of 7 preset command paths.
az find This is an AI robot that will return reference examples for keywords. Type az find "active subscription" in your console then Enter.

Another great way to learn to use the Azure CLI is through Microsoft Learn Modules for CLI tools. When the module provides a sandbox environment, use the sandbox to try new commands without incurring costs.

Common usage questions

Question Reference command answer Learn more
How do I know what subscription I'm using? az account show --output table How to manage Azure subscriptions with the Azure CLI
How do I change my subscription? az account set --subscription "mySubscriptionName" How to manage Azure subscriptions with the Azure CLI
How can I set a default resource group and location? az config set defaults.location=westus2 defaults.group=MyResourceGroup Configure settings using az config
How do I query command output? az account show --query "{tenantId:tenantId,subscriptionid:id}" See How to query Azure CLI command output using a JMESPath query for many --query examples in Bash, PowerShell and Cmd.
How do I format output from a command? az account list --output table Output formats for Azure CLI commands
Can you help me to learn Bash with Azure CLI commands? Absolutely! We all have different technical strengths, and for that reason, Microsoft offers a How-to guide for learning Bash. Enjoy! Learn to use Bash with the Azure CLI