Running Azure CLI from Babun (Cygwin)

Oleksii Chekulaiev
1 min readDec 15, 2017

--

You begin with installing the MSI provided in the instructions. However you will quickly notice, that while running az works from the Command Prompt, it does not work from Babun (Cygwin).

The problem is that Azure CLI is a az.cmd file. Which means it is a Windows Batch file — a script, not an executable binary. So Babun (Cygwin) will not be able to natively run it.

What you can do is you can create a Bash script to run az.cmd via cmd.exe.

  1. Create a file /usr/local/bin/az
  2. Pu these contents inside:
#!/bin/bashcd /c/Program\ Files\ \(x86\)/Microsoft\ SDKs/Azure/CLI2/wbin
cmd.exe /c az.cmd “$@”

3. Just in case you forgot to use UNIX line endings convert them:

dos2unix /usr/local/bin/az

4. Make it executable

chmod +x /usr/local/bin/az

5. Now you can use it from Babun (Cygwin) as az [command] .

--

--

Oleksii Chekulaiev
Oleksii Chekulaiev

Written by Oleksii Chekulaiev

Drupal Technical Lead, Docksal creator and maintainer

Responses (2)