Skip to content

Using Azure CLI from Command Prompt

Azure CLI is a powerful tool for managing Azure resources directly from the command line. Follow these steps to use it effectively from the Windows Command Prompt:

Install Azure CLI

Download and install Azure CLI for Windows using the official MSI installer.

After installation, restart your Command Prompt to ensure the az command is recognized.

Verify Installation

Check if Azure CLI is installed correctly by running:

az version

Sign In to Azure

Use the az login command to authenticate, this opens your default browser for sign-in. If a browser isn't available, use: az login --use-device-code

Follow the instructions to authenticate via a device code.

Execute Commands

Azure CLI commands follow this structure:

az <command-group> <command> [parameters]

Manage Subscriptions

If you have multiple subscriptions, set the active one:

az account set --subscription "<subscription-id>"

Explore Commands

Use --help to explore available commands and parameters:

az vm --help

Best Practices

  • Use --output to format results (json, table, etc.).
  • Enable tab completion in PowerShell for faster command entry.
  • Regularly update Azure CLI with: az upgrade

By following these steps, you can efficiently manage Azure resources directly from the Command Prompt

Learn more