GIT Bash can't run az network bastion commands - fails on resource id

181 views
Skip to first unread message

Ed Greenberg

unread,
Feb 24, 2023, 3:15:31 PM2/24/23
to git-for-windows

Azure has a command that opens a tunnel or an rdp port:

 

az network bastion tunnel --name vnet-happy-dev-eastus-001-bastion --resource-group rg-us03-dev-happy --target-resource-id /subscriptions/a4181df7-xxxxxxxxxxxxxxxxxxx8f3ca86/resourceGroups/rg-xxxxxx/providers/Microsoft.Compute/virtualMachines/vm-cronserver-dev-eastus-004 --resource-port 22 --port 2222

 

Under cmd it runs fine, but under git-bash it errors out as follows:

 

ERROR: Please enter a valid Virtual Machine resource Id.

 

Another user reported this in https://github.com/Azure/azure-cli/issues/21056 but they tossed it off as a git-bash problem.  

 

Is there any help for this?

 

Thanks,

Ed Greenberg

Ed Greenberg

unread,
Mar 1, 2023, 11:02:05 AM3/1/23
to git-for-windows
I found a workaround for this.  I put the 'az network bastion tunnel command' in a good old dos batch file. Saved it on gitbash's path, and ran it a filename.bat (the .bat is important).  Since gitbash seamlessly launched cmd to run this, no need for a cmd window.
Reply all
Reply to author
Forward
0 new messages