Freigeben über


Installing Azure CLI 2.0 on Windows

Azure CLI 2.0 is now in GA !

This release of Azure CLI 2.0 is the first GA release. Azure CLI 2.0 release has command updates for

  • ACS (Azure Container services)
  • Compute
  • Networking
  • Storage

The Azure CLI can be used on Linux, MacOS and Windows. While the official documentation here mentions all the steps required for installation in all supported operating systems, for windows people may face this issue when right after installation when you try to run an az command it says "az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program."

The issue is because the azure cli 2.0 is installed in location - C:\Users\<username>\AppData\Local\Programs\Python\Python35\Scripts\  and this path isn't added to the PATH variable. Well! until that happens here is the fix

First make sure you have python installed in your machine. If you don’t have the original CLI (or python) at all, you need that first. Download and install it from here: https://www.python.org/downloads/release/python-352/

  • Uninstall Azure CLI earlier versions with command - pip uninstall azure-cli
  • Re-install Azure CLI 2.0 - pip install --user azure-cli
  • Add the path C:\Users\<username>\AppData\Local\Programs\Python\Python35\Scripts\ to PATH variable                                                                                                                                                                                                                                    setx PATH "%PATH%;C:\Users\<username>\AppData\Local\Programs\Python\Python35\Scripts\"
  • check if the az command is working - az --help

Ideally the tool must have removed the older cli and made necessary changes in the PATHs. If it still doesn't work just drop me a comment or DM me @brijrajsingh

Comments

  • Anonymous
    March 06, 2017
    Thanks for the article. It's important to add that if you don't have the original CLI (or python) at all, you need that first. Download and install it from here: https://www.python.org/downloads/release/python-352/
    • Anonymous
      March 10, 2017
      Thanks, Updating it in the article
  • Anonymous
    March 06, 2017
    I have installed the CLI 2 (on windows 7) and also added C:\Users\AppData\Roaming\Python\Python35\site-packages to the PATH variables in the environment variables. But still the AZ commands are not working. Are there any other setting we need to look into to make this working?
    • Anonymous
      March 10, 2017
      Hi @Hoang have you uninstalled the previously installed Azure CLI, also please make sure that the path has the azure cli 2.0 packages in it C:\Users\AppData\Roaming\Python\Python35\site-packages, the path may be different in your machine, this path you should be able to see during cli installation itself.
      • Anonymous
        March 10, 2017
        Removing the --user worked for me. Thanks!
        • Anonymous
          April 03, 2017
          great