Azure Command-Line Interface (CLI)

Introduction to Azure CLI

The Azure Command-Line Interface (CLI) is a powerful, cross-platform tool for managing Azure resources. It enables you to interact with Azure services through commands entered in your command-line interface. The Azure CLI is designed for developers and IT professionals who want to automate tasks, manage resources efficiently, and integrate Azure management into their existing workflows.

With the Azure CLI, you can perform a wide range of operations, including:

  • Creating and managing virtual machines.
  • Deploying applications to Azure App Service.
  • Configuring Azure storage accounts.
  • Managing Azure Kubernetes Service (AKS) clusters.
  • Working with Azure databases.
  • And much more!

Key Features

  • Cross-Platform: Available on Windows, macOS, and Linux.
  • Powerful Scripting: Easily integrate Azure management into shell scripts.
  • Extensible: Supports extensions for custom functionalities and third-party tools.
  • Interactive Mode: Provides guidance and auto-completion for commands.
  • JSON Output: Outputs results in JSON format, making it easy to parse and process.

Getting Started with Azure CLI

To begin using the Azure CLI, you'll need to install it on your local machine. Once installed, you can log in to your Azure account using the az login command.

az login
Logs you into your Azure account.

After logging in, you can start executing commands to manage your Azure resources. For example, to list all subscriptions associated with your account:

az account list --output table
Lists your Azure subscriptions in a table format.

You can find detailed installation instructions and more examples on the Installation and Get Started pages.

Core Concepts

The Azure CLI is organized around resources and commands. You typically interact with Azure services by specifying a service group (e.g., vm for virtual machines, storage for storage accounts) followed by a specific command and its arguments.

The general syntax is:

az [group] [command] [options]

For example, to create a resource group:

az group create --name MyResourceGroup --location eastus
Creates a new resource group named 'MyResourceGroup' in the 'eastus' region.