Azure CLI in Git Bash

Pectus Excavatum picture Pectus Excavatum · Mar 23, 2017 · Viewed 19.7k times · Source

I am trying to use a bash (sh) script on windows to run a test deployment. I am running the script from the gitbash console so that I have a copy of bash, but doing so means that the azure clie is not available (i.e. azure command is not found). Does anyone know how I can get the Azure cli working in GitBash (I am assuming I just install it somewhere else) or should I change to a different way of using bash

Answer

whindes picture whindes · Nov 2, 2017

Sometimes commands in windows git bash need .cmd appended. Also, another way of installing the Azure-Cli is through Chocolatey https://chocolatey.org/

Try this command after Azure-Cli is installed:

az.cmd --version

Echoing mscrivo you can run the line below in CMD not PowerShell (elevated/admin)

echo "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} > "C:\Program Files\Git\mingw64\bin\az" 

Now you should be able to run in Git bash:

az --version