azure-cli
Manage Azure resources from the command line
TLDR
View documentation for the original command
SYNOPSIS
az [global options]
Examples:
az login
az vm create --name myVM --resource-group myResourceGroup --image UbuntuLTS --admin-username azureuser
az group list --output table
PARAMETERS
--help, -h
Displays help information for a command or command group. Use az
--output, -o
Sets the output format for the command. Common formats include json (default), jsonc (colorized JSON), table, tsv (tab-separated values), yaml, and none. This is crucial for scripting.
--query
Uses a JMESPath query string to filter or transform the JSON output of a command. This is powerful for extracting specific data points from complex responses.
--debug
Increases logging verbosity to show all debug logs, including HTTP requests and responses. Extremely useful for troubleshooting command execution issues.
--verbose
Increases logging verbosity to show more information during command execution, such as warnings and informational messages, but less than --debug.
--only-show-errors
Suppresses warnings and informational messages, showing only errors in the output. Ideal for ensuring clean output in automated scripts.
--subscription
Specifies the Azure subscription ID or name to operate on, overriding the default active subscription. This is useful when managing resources across multiple subscriptions.
--version
Displays the version of the Azure CLI currently installed on your system.
DESCRIPTION
The Azure CLI is a powerful, cross-platform command-line tool that allows you to connect to Azure and execute administrative commands on Azure resources. It provides a comprehensive set of commands used to create, manage, and delete resources across the entire Azure cloud platform, encompassing services from virtual machines, storage accounts, and networking to more advanced offerings like Azure Kubernetes Service, Azure Functions, and Azure Cosmos DB.
Written in Python, the Azure CLI is designed for automation and scripting, making it an essential tool for developers, DevOps engineers, and cloud administrators. It supports various authentication methods, including interactive login, service principals, and managed identities, ensuring secure and flexible access to your Azure subscriptions. Commands are logically grouped by service and resource type, providing a consistent and intuitive interface for interacting with Azure resources programmatically.
CAVEATS
The Azure CLI requires a Python environment for installation and execution on Linux. All operations performed through the CLI interact with your Azure subscription and can potentially incur costs, depending on the resources created, modified, or consumed. Users must be authenticated to Azure (e.g., via az login) to perform any operations on resources. Furthermore, stable network connectivity to Azure services is essential for the CLI to function correctly.
AUTHENTICATION
Before interacting with Azure resources, you must authenticate your Azure CLI session. The most common method is az login, which typically opens a browser for interactive authentication. For automated or non-interactive scenarios, authentication via service principals (using az login --service-principal) or managed identities is supported.
MODULAR DESIGN AND EXTENSIONS
The Azure CLI boasts a modular design, meaning core functionalities are kept lean, and commands for specific Azure services or advanced features are often delivered as extensions. This allows users to install only the components they need, enhancing performance and flexibility. Extensions can be installed using az extension add.
HISTORY
The Azure CLI has undergone significant evolution since its initial release. The first version, often referred to as CLI 1.0, was built on Node.js. In 2017, Microsoft introduced CLI 2.0, a major rewrite in Python, which became the standard. This transition aimed to enhance cross-platform compatibility, improve modularity, and streamline the developer experience. Since then, it has seen continuous active development with frequent updates and releases, providing new features and supporting the latest Azure services. It is open-source and actively maintained by Microsoft on GitHub, fostering community contributions and transparency.