Azure CLI Documentation

The Azure Command-Line Interface (CLI) is a powerful tool for managing Azure resources from your command line. It allows you to interact with Azure services, automate tasks, and deploy infrastructure efficiently.

Key Features

Getting Started

To begin using the Azure CLI, you'll need to install it on your machine. You can find detailed installation instructions for your operating system on the installation page.

Once installed, you can log in to your Azure account using the following command:

az login

This command will open a browser window for you to authenticate. After successful login, you can start managing your Azure resources.

Common Commands

Here are a few examples of common Azure CLI commands:

Resource Group Management

Create a new resource group:

az group create --name MyResourceGroup --location eastus

List all resource groups:

az group list --output table

Virtual Machine Management

Create a new virtual machine:

az vm create --resource-group MyResourceGroup --name MyVM --image Ubuntu2204 --admin-username azureuser --generate-ssh-keys

List all virtual machines in a resource group:

az vm list --resource-group MyResourceGroup --output table

Using Help

The Azure CLI provides extensive help. You can get help on any command by appending --help:

az vm --help

Or for a specific subcommand:

az vm create --help
Tip: Use the --output table or --output json flags to format command results in a more readable way.
Note: Ensure you are logged in to the correct Azure subscription before running commands. Use az account list to see your subscriptions and az account set --subscription <SUBSCRIPTION_ID> to switch.

Explore the left-hand navigation to discover more commands and detailed documentation for various Azure services.