Skip to content

Latest commit

 

History

History
183 lines (130 loc) · 5.06 KB

File metadata and controls

183 lines (130 loc) · 5.06 KB
title Install the Azure CLI 2.0
description Reference docs for Azure CLI 2.0
keywords Azure CLI 2.0, Azure CLI 2.0 Reference, Install Azure CLI 2.0, Azure Python CLI
author allclark
manager douge
ms.author allclark
ms.date 02/03/2017
ms.topic article
ms.prod azure
ms.technology azure
ms.devlang azure-cli
ms.assetid ea5c0ee1-c530-4a1e-a83f-e1be71f6d416

Install Azure CLI 2.0

This is the new version of CLI for Azure - improved and updated to provide a more native command line experience in bash for managing Azure resources.

Bash

  1. If you don't have it, install Python.

  2. You may need to install requisites.

    sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev
    Platform Prerequisites
    OS X
    Ubuntu 16.06 LTS or 15.10 libssl-dev libffi-dev python-dev build-essential
    Ubuntu (other) libssl-dev libffi-dev python-dev
    Debian 8 libssl-dev libffi-dev python-dev build-essential
    Debian 7 libssl-dev libffi-dev python-dev
    CentOS gcc ibffi-devel python-devel openssl-devel
    RedHat gcc libffi-devel python-devel openssl-devel
    SUSE gcc libffi-devel python-devel openssl-dev
  3. Install Azure CLI 2.0.

    curl -L https://aka.ms/InstallAzureCli | bash
  4. Restart your shell.

    exec -l $SHELL

Windows

Get Azure 2.0 CLI on Windows using pip.

  • If you're running bash on Windows, follow the steps for bash.
  • You can also use Docker to access the CLI without installing Python and pip.
  1. If you don't already have Python 2.7, 3.4 or 3.5 installed, install version 3.5.x.

    Visit the Python site and download Python 3.5 for your OS.

    Add Python 3.5 to your path during installation.

    Check your Python installation from a command prompt.

    python --version
    
  2. Install Azure CLI 2.0 using pip.

    pip install azure-cli
    

    Run Azure CLI 2.0 from the command prompt.

    az
    

Docker

Our docker images contain the latest code from the master branch.

Run

docker run -it azuresdk/azure-cli-python:latest bash

Installation Troubleshooting


Errors with curl redirection

If you get an error with the curl command regarding the -L parameter or an error saying Object Moved, try using the full url instead of the aka.ms url:

# If you see this:
$ curl -L https://aka.ms/InstallAzureCli | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   175  100   175    0     0    562      0 --:--:-- --:--:-- --:--:--   560
bash: line 1: syntax error near unexpected token `<'
'ash: line 1: `<html><head><title>Object moved</title></head><body>

#### Try this instead:
$ curl https://azurecliprod.blob.core.windows.net/install | bash

Errors on install with cffi or cryptography

If you get errors on install on OS X, upgrade pip.

pip install --upgrade --force-reinstall pip

If you get errors on install on Debian or Ubuntu such as the examples below, install libssl-dev and libffi-dev.

sudo apt-get update
sudo apt-get install -y libssl-dev libffi-dev

Also install Python Dev for your version of Python.

Python 2:

sudo apt-get install -y python-dev

Python 3:

sudo apt-get install -y python3-dev

Ubuntu 15 may require build-essential also:

sudo apt-get install -y build-essential

Example Errors

Downloading cffi-1.5.2.tar.gz (388kB)
    100% |################################| 389kB 3.9MB/s
    Complete output from command python setup.py egg_info:

        No working compiler found, or bogus compiler options
        passed to the compiler from Python's distutils module.
        See the error messages above.
        (If they are about -mno-fused-madd and you are on OS/X 10.8,
        see http://stackoverflow.com/questions/22313407/ .)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-77i2fido/cffi/
#include <openssl/e_os2.h>
                            ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Failed building wheel for cryptography

See Stack Overflow question - Failed to install Python Cryptography package with PIP and setup.py

Reporting issues and feedback

If you encounter any bugs with the tool, file an issue in the Issues section of our GitHub repo. To provide feedback from the command line, try the az feedback command.