For ARM-based service please go to CLI 2.0.
Switch branches/tags
Clone or download
amarzavery Merge pull request #3695 from MikhailTryakhov/dev-local
Added associate/deassociate commands to ASM reserved IP, improved reserved-ip create command
Latest commit 97aa88f Oct 9, 2018
Failed to load latest commit information.
.github Update Nov 14, 2017
Documentation Update Nov 18, 2017
bin refactor telemetry.js so that the datamodel here Nov 28, 2016
features Add contributors.txt and update copyrights Nov 26, 2013
lib fixed deployment names Oct 5, 2018
scripts Added InitiateMaintenance CLI command and also added MaintenanceStatu… Mar 24, 2017
test Updated recordings Nov 30, 2017
tools update changelog, package.json and node.js/npm version in installer s… Jun 6, 2018
.dockerignore Added dockerignore file Jul 12, 2016
.gitattributes Bring back deployment scripts Dec 5, 2012
.gitignore Added typing files to gitignore Aug 31, 2016
.jshintignore This is a private branch, people check in SDK libs in here because th… Aug 10, 2017
.jshintrc 'network dns record-set list' output improved, #1779 fixed Jan 26, 2016
.npmignore updated npmignore file Jul 13, 2016
.travis.yml Adding comments, per PR feedback May 30, 2017
CONTRIBUTORS.txt Add contributors.txt and update copyrights Nov 26, 2013 update changelog, package.json and node.js/npm version in installer s… Jun 6, 2018
Dockerfile docker build use latest source (#3001) Jul 11, 2016
LICENSE.txt code fix Aug 2, 2016 move2cli2 update readme Nov 14, 2017
appveyor.yml Update access token Feb 13, 2017
cli.njsproj Removing more instances of mobile May 26, 2017
cli.sln add default vs nodejs project Aug 11, 2015 correct naming for testlist-arm.txt Mar 26, 2016
package-lock.json Fixed ip association issues Oct 5, 2018
package.json update changelog, package.json and node.js/npm version in installer s… Jun 6, 2018
xcli-cloned.sln Changed networking quotas/usage command 'azure network usage list <re… Jun 4, 2016

Microsoft Azure Xplat-CLI for Windows, Mac and Linux

NPM version Build Status

This project provides a cross-platform command line interface for developers and IT administrators to develop, deploy and manage Microsoft Azure applications.

Please consider using Azure CLI 2.0, the preferred choice for ARM (Azure Resource Manager) commands.

CLI 2.0 migration guide can be found here.


  • Accounts Management
  • Azure Service Management
    • Storage
    • Websites
    • Virtual machines
    • Network
    • Service Bus
    • SQL Database
  • Azure Resource Management
    • Generic resource groups and deployments management
    • Role based access control
    • Cmdlets for individual resource providers, including compute, storage, network, redis cache, insights, etc.
    • Datalake
    • CDN
    • HDInsight (Note: The HDInsight commands in ASM mode are deprecated and will be removed by Jan. 2017)
    • Key Vault
    • Batch
  • Service fabric management (Only works for Linux cluster currently, coming soon on Windows cluster)

Note: The list of features may not be up-to-date. For accurate command details, type azure | azure -h | azure --help to navigate through the help system. Also, use azure config mode asm|arm to switch between service management (Version V1)and resource management (Version V2) of the Azure REST API.

Endpoints for Azure

The CLI targets "Public Azure Cloud" by default. You can get more information about the endpoints supported in different environments from here.

Non-Interactive Authentication

If you need to create an automation account for non interactive or scripting scenarios then please take a look at the documentation over here.

Supported Environment Variables

Please take a look at the list of supported environment variables over here.


Installation from a particular branch of this repository

  • Uninstall the previously installed CLI
    • If you installed via MSI, then uninstall the windows MSI. For mac installer sudo azure-uninstall -g
    • If you installed via npm then execute: npm uninstall -g azure-cli
  • Clear the global cache:
    • If npm4.0 or before: npm cache clear -g
    • If npm5.0 or greater npm cache verify
  • Delete the .streamline folder from the User’s home profile C:\Users\<username>\.streamline | ~/.streamline, if present.
  • Download the tarball from this link:<branch-name>.tar.gz
  • Install from the tarball: npm install –g <path to the downloaded tarball>

And you should be good to go :). Note: You may require admin prompt or sudo access to install via npm.

Installation from npm

You can install the azure-cli npm package directly.

npm install -g azure-cli

Installing the latest version of node.js on different linux flavors

This document provides simple steps to install the latest version of node.js on a linux system. After successful installation of node.js, you can install "azure-cli" via npm as decribed above.

Installation on a Docker Host

In a Docker host, run:

sudo docker run -it microsoft/azure-cli 

You can clone the repo and use the "Dockerfile" from master branch. It should install the last released version of azure-cli.

Pre-compiled installers

Configure auto-complete

Auto-complete is supported for Mac and Linux.

To enable it in zsh, run:

echo '. <(azure --completion)' >> .zshrc

To enable it in bash, run:

azure --completion >> ~/
# For macOS Terminal(login shell)
echo 'source ~/' >> ~/.bash_profile
# For Linux Terminal(non-login shell)
echo 'source ~/' >> ~/.bashrc

To enable it in fish, run:

echo 'azure --completion-fish | source' >> ~/.config/fish/

Get Started

  • First, get authenticated with Microsoft Azure. For details, read this article.
    • Option 1: Login with your Microsoft account, such as live-id, or organizational account, or service principals.
    • Option 2: Download and import a publish settings file which contains a management certificate.

If you use both mechanisms on the same subscription, Azure Active Directory authentication will be used by default. If you want to go back to management certificate authentication, please use azure logout, which will remove the Azure Active Directory information and bring management certificate authentication back in.

Login directly from xplat-cli (Azure Active Directory authentication) - works with ARM & ASM (Version V2 & V1) of Azure API

# This will output an url and a device code for you to use browser to login  
azure login

# This will prompt for your password in the console
azure login -u <your organizational ID email address>

# This will login in using a service principal
azure login -u "<service-principal-id>" -p "<key>" --service-principal --tenant "<tenant-id>"

Use publish settings file (Management certificate authentication) - works only with ASM (Version V1) of Azure API

# Download a file which contains the publish settings information of your subscription.
# This will open a browser window and ask you to log in to get the file.
azure account download

# Import the file you just downloaded.
# Notice that the file contains credential of your subscription so you don't want to make it public
# (like check in to source control, etc.).
azure account import <file location>

# Use the commands to manage your services/applications
azure site create --location "West US" mywebsite

azure cli with China Cloud

# This will log you into the China Cloud environment.
# You can use same set of commands to manage your service/applications
azure login -u <your organizational ID email address> -e AzureChinaCloud

azure cli on Ubuntu

If you want to run xplat cli on Ubuntu, then you should install nodejs-legacy instead of nodejs. For more information please check the following links:

Please perform the installation steps in following order:

sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm install -g azure-cli

2 Modes

Starting from 0.8.0, we are adding a separate mode for Resource Manager. You can use the following command to switch between the

  • Service management: commands using the Azure service management API
  • Resource manager: commands using the Azure Resource Manager API

They are not designed to work together.

azure config mode asm # service management
azure config mode arm # resource manager

For more details on the commands, please see the command line tool reference and this How to Guide


Usage is the same as vm create command:

azure vm docker create [options] <dns-name> <image> <user-name> [password]

This command only supports Ubuntu 14.04+ and CoreOS based images. Docker is configured on the VM using HTTPS as described here: By default, generated TLS certificates are placed in the ~/.docker directory, and Docker is configured to run on port 2376. These can be configured using new options:

-dp, --docker-port [port]              Port to use for docker [2376]
-dc, --docker-cert-dir [dir]           Directory containing docker certs [~/.docker/]

After the VM is created. It can be used as a Docker host with the -H option or DOCKER_HOST environment variable.

docker --tls -H tcp://<my-host> info

Note: To run docker commands on windows make sure ssl agent is installed.

Error Diagnostic

use the -vv option to see the actual REST requests on the console.

azure site create --location "West US" mytestsite -vv

Use web debugging proxy

Say, use 'Fiddler', setup the following environment variables before execute commands.


Running Tests

See this page for instructions that describe how to run the test suite.

Learn More

For documentation on how to host Node.js applications on Microsoft Azure, please see the Microsoft Azure Node.js Developer Center.

Contribute Code or Provide Feedback

If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.

Please send pull requests only to the Dev branch. Please make sure that you have checked in tests and recorded them live for your contribution. Pull requests without sufficient tests will not be accepted.

If you encounter any bugs with the library please file an issue in the Issues section of the project.