Saturday, April 15, 2017

Configuring Azure CLI 2.0 on Windows 10

Azure CLI is a cross platform scripting tool that runs on Linux, Mac and Windows.

There are two versions of the Azure Command-Line Interface (CLI) currently available:

  • Azure CLI 2.0: Next-generation CLI written in Python, for use with the Resource Manager deployment model.
  • Azure CLI 1.0: CLI written in Node.js, for use with both the classic and Resource Manager deployment models.

What we’ll cover here is how to install version 2.0 on a Windows 10 machine. To do this you basically need to follow the following steps in this article:

Install Azure CLI 2.0

image

You’ll need to firstly download Python for Windows which you will find here:

https://www.python.org/downloads/

Select the most current version (here 3.6.1).

image

Once you have downloaded the file, right mouse click on the downloaded file and select Run as administrator.

Accept the UAC that appears.

image

The install splash screen should now appear. Before you commence the install ensure the option to Add Python to PATH is selected at the bottom of the dialog as shown.

Select the Install now option to commence the installation.

image

You should now see the installation progressing.

image

Select Close when complete.

image

Open a command prompt and type:

python –-version

to which you should see the version number as shown above indicating that Python has install as expected.

You now need to install the Azure CLI which you do using the command:

pip install –-user azure-cli

image

image

You should then see a range of package being downloaded as shown above.

This process will take a few minutes to complete.

image

When the process is complete, you’ll be returned to the command prompt as shown.

image

The command that you run to launch the CLI environment is az.bat. That has been installed in:

C:\Users\<current user>\AppData\Roaming\Python\Python36\Scripts

which unfortunately has not been added to the PATH environment. So you’ll need to add this for convenience.

image

From the Windows 10 Start type environ and you should see the option Edit environment variables for your account at the top of the list as shown. Select this.

image

Select the Path line in the top box and then select the Edit button.

image

Select New and add the path to the az.bat file as shown above.

Select OK twice to save your changes and exit.

image

image

If you now go to the command prompt and type:

az

you should see the Azure CLI appear as shown above. You are now ready to use Azure CLI 2.0 on Windows to manage your Azure environment.