Azure-cli: .msi install doesn't work with git-for-windows bash

Created on 24 May 2017  路  9Comments  路  Source: Azure/azure-cli

Description

Installing the .msi (0.2.9) and issuing the az command in the bash shell that comes with https://git-for-windows.github.io gives the following error:

C:\Program Files\Python36\python.exe: No module named azure.cli.__main__; 'azure.cli' is a package and cannot be directly executed

Environment summary

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: Installed using the .msi.

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here:

azure-cli (2.0.6)

acr (2.0.4)
acs (2.0.6)
appservice (0.1.6)
batch (2.0.4)
cdn (0.0.2)
cloud (2.0.2)
cognitiveservices (0.1.2)
command-modules-nspkg (2.0.0)
component (2.0.4)
configure (2.0.6)
core (2.0.6)
cosmosdb (0.1.6)
dla (0.0.6)
dls (0.0.6)
feedback (2.0.2)
find (0.2.2)
interactive (0.3.2)
iot (0.1.5)
keyvault (2.0.4)
lab (0.0.4)
monitor (0.0.4)
network (2.0.6)
nspkg (3.0.0)
profile (2.0.4)
rdbms (0.0.1)
redis (0.2.3)
resource (2.0.6)
role (2.0.4)
sf (1.0.1)
sql (2.0.3)
storage (2.0.6)
vm (2.0.6)

OS Version: What OS and version are you using?
Answer here: Windows 10 Enterprise (1607)

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: Git Bash from https://git-for-windows.github.io

Packaging

Most helpful comment

The issue is fundamentally not recognizing the .cmd execution extension in windows. Just alias it out in the git bash shell wiht "alias az='az.cmd'"

It's really annoying when we see very limited if any invested interest in understanding the actual problem. Many people including myself ran into this, so I figured I would solve it since I reverse engineered the problem for some other hacks.

Also, you really only need to pre-empt the login process using Windows Command Line or PowerShell.

All 9 comments

Does it work in cmd.exe?

Yes, it does. Sorry, should have mentioned.

We don't officially support Git Bash.
I would recommend using cmd.exe or if you'd like a *nix experience, Bash on Windows is available and the CLI can be installed with apt-get see this.

Closing this issue as git-bash is not a supported shell for the CLI.

I really wish this issue would be reopened. There are tons of people who use Git Bash in favor of WSL. There are still various issues with WSL, while Git Bash works natively and works well.

I tried in windows 7 : git bash az.cmd --version

It worked.

The issue is fundamentally not recognizing the .cmd execution extension in windows. Just alias it out in the git bash shell wiht "alias az='az.cmd'"

It's really annoying when we see very limited if any invested interest in understanding the actual problem. Many people including myself ran into this, so I figured I would solve it since I reverse engineered the problem for some other hacks.

Also, you really only need to pre-empt the login process using Windows Command Line or PowerShell.

@rondemena. Thanks much.

A good workaround that helped me: https://stackoverflow.com/a/47085659/1651761

Was this page helpful?
0 / 5 - 0 ratings