question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[az ad sp create-for-rbac] Command doesn't work in git bash on windows, works fine on cmd

See original GitHub issue

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Related command

az ad sp create-for-rbac --name="sp-test" --role="Contributor" --scopes="/subscriptions/<subscription_id>" --sdk-auth --only-show-errors

Describe the bug Running the command above on Git Bash terminal fails with the error shown below. The exact same command works when run in regular cmd terminal.

image

To Reproduce

  1. On a windows machine with Git For Windows installed, open a Git Bash terminal
  2. Run the command: az ad sp create-for-rbac --name="sp-test" --role="Contributor" --scopes="/subscriptions/<subscription_id>" --sdk-auth --only-show-errors

Expected behavior The command works the same, whatever the terminal.

Environment summary

Freshly installed Azure CLI on a Windows 10 machine.

 az --version
azure-cli                         2.42.0

core                              2.42.0
telemetry                          1.0.8

Dependencies:
msal                              1.20.0
azure-mgmt-resource             21.1.0b1

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\sinedied\.azure\cliextensions'

Python (Windows) 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:37:59) [MSC v.1933 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context On a 3h workshop where we’re using Azure CLI to provision the whole infrastructure, this is the only command not working on a git Bash terminal. Here’s the workshop for context: https://azure.github.io/aca-java-runtimes-workshop/#creating-an-azure-service-principal

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
beboundcommented, Nov 8, 2022

No, it only works in Git Bash.

0reactions
sinediedcommented, Nov 8, 2022

Or use //subscriptions instead of /subscriptions in scope.

Thanks for the workaround suggestion. Does this work on all platforms?

Read more comments on GitHub >

github_iconTop Results From Across the Web

When I run az ad sp create-for-rbac --sdk-auth > my.azureauth ...
By default, this command assigns the 'Contributor' role to the service principal at the subscription scope.
Read more >
github api does not work in git bash, but in cmd it does
Hello when I am testing the github api in Git Bash everything works fine until I use this command:
Read more >
Using secrets from Azure Key Vault in a pipeline
A service principal is automatically created by Azure Pipeline when you connect to an ... az ad sp create-for-rbac -n ServicePrincipalName.
Read more >
Git on the command line - GitLab Docs
To execute Git commands on your computer, you must open a terminal (also known as command prompt, command shell, and command line). Here...
Read more >
Working with Git Bash Commands - phoenixNAP
An easy tutorial on how to use the Git Bash terminal in Windows. Git Bash emulates the Unix bash shell, providing a command-line...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found