Using the Azure CLI on Windows
The Azure Command Line Interface (CLI) provides a command line and scripting environment for creating and managing Azure resources. The Azure CLI is available for macOS, Linux, and Windows operating systems. Across these operating systems, the CLI commands are identical, however operating system specific scripting syntax can differ.
This document details the ways that the Azure CLI can be installed and run on Windows and details syntactical considerations for each. For in-depth Azure CLI documentation see, Azure CLI documentation.
Windows Subsystem for Linux
The Windows Subsystem for Linux (WSL) provides an Ubuntu Linux environment on Windows 10 Anniversary and later editions. When enabled, WSL provides a native Bash experience, which can be used for creating and running Azure CLI scripts. Because WSL provides a native Bash experience, Azure CLI scripts can be shared between macOS, Linux, and Windows without modification.
To use the Azure CLI in WSL, complete the following.
|Enable WSL||Install WSL documentation|
|Install the Azure CLI||Install the CLI on WSL/Ubuntu 14.04|
The Azure CLI can be run natively in Windows. In this configuration, the Azure CLI package is installed on the Windows operating system, and commands can be run from PowerShell. In this configuration, Azure CLI commands and scripts can be run on any supported version of Windows, however platform specific scripting syntax is required. Because of this, scripts cannot necessarily be shared between macOS, Linux, and Windows without modification.
To use the Azure CLI on Windows, install the package using these instructions, Install the CLI on Windows.
When using Docker for Windows, a Docker image can be started that includes the Azure CLI. This image is based off of Linux, and includes a native Bash experience. When using Docker for Windows and the Azure CLI image, scripts to be shared between macOS, Linux, and Windows.
To use the Azure CLI on Docker for Windows, ensure that Docker for Windows is running and run the following command.
docker run -it azuresdk/azure-cli-python:latest bash
Once completed, a Bash session will start that is preloaded with the Azure CLI tools.