wolfgang ziegler


„make stuff and blog about it“

Getting started with Azure Command Line Tools

April 25, 2015

The Azure Comand Line Tools are a useful collection of open source and cross-platform tools (based on JavaScript and node.js) to manage all your Azure services from the command line.

If you already have node.js on your machine you can simply install the Azure Command Line Tools like this:

> npm install azure-cli –g

If not, you can use Microsoft’s Web Platform Installer package.

Web Platform Installer 5.0

For some inexplicable reason a reboot (seriously?!) is required and only then the Azure Command Line Tools are available in PowerShell. Give it a spin and just type azure.

Azure Powershell

Let’s use these tools and do a little example. We want to log in and restart one of our Azure web sites.

Log In

  • The easiest way is using a a Publish Settings File. You can download this from the Azure website (where you are already authenticated). You get there through the command line by typing
    > azure account download
  • Then save the Publish Settings File to a location where you’ll find it again.
  • Import the file with following command
    > azure account import <PATH TO FILE>

List All Web Sites

The command
> azure site list
retrieves a list of all the Azure Web sites running under you account.
Azure Site List

Restart a Web Site

The Azure Command Line interface is actually pretty intuitive. Everyhting follows the AZURE – NOUN – VERB [OPTIONS] pattern.

So if we want to stop a web site, we use:
> azure site stop <NAME OF THE WEB SITE>

To start it again, we use
> azure site start <NAME OF THE WEB SITE>