Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on az ad sp create-for-rbac #24857

Closed
MarkBird opened this issue Feb 13, 2019 — with docs.microsoft.com · 13 comments
Closed

Error on az ad sp create-for-rbac #24857

MarkBird opened this issue Feb 13, 2019 — with docs.microsoft.com · 13 comments

Comments

Copy link

There seems to be a bug creating service principal (running on Git Bash) -

If I run az ad sp create-for-rbac --name $ACR_NAME-pull --scopes $(az acr show --name $ACR_NAME --query id --output tsv) --role acrpull --query password --output tsv I get an error in requests:

msrest.exceptions.ClientRequestError: Error occurred in request., InvalidSchema: No connection adapters were found for <path>

For some reason it seems to be concatenating a Git folder path:

C:/Users/<username>/AppData/Local/Programs/Git

with the result of $(az acr show --name $ACR_NAME --query id --output tsv) which looks like:

/subscriptions/<id>/resourceGroups/<resource group name>/providers/Microsoft.ContainerRegistry/registries/<registry name>/providers/Microsoft.Authorization/roleDefinitions?$filter=roleName%20eq%20%27acrpull%27&api-version=2018-01-01-preview

resulting in it trying to make an HTTP request to a file location on my C: drive, which obviously doesn't work


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Copy link
Author

This seems to be a problem running on Git Bash - with some modification I managed to run the same command on a Command Prompt and it worked

@mimckitt
Copy link
Contributor

Thanks for the feedback! We are currently investigating and will update you shortly.

@mimckitt
Copy link
Contributor

@MarkBird generally the commands are written to run in the Azure Cloud shell which I tested and did not get the same error. Running on a on-prem bash environment sometimes does not work exactly as copied. We have had this kind of issue on a few docs. Unfortunately it is hard to write commands and scripts that will work for everyone specific environment.

I will close this out as the commands do appear to work as written in the Cloud Shell environment

CC @dlepow

@richmhouse
Copy link

It would be very helpful to people in the future if you could sort this out. Just saying it's ok cos it wroks in the cloud shell is just very annoying to those whove wasted an hour or two using Bash before finding this. issue.

@PRMerger8 PRMerger8 added the Pri2 label May 8, 2020
@mruepp
Copy link

mruepp commented Sep 8, 2020

Yes, to state that its hard to write scripts to work everywhere is a bit like state that its enough to write software which works only on my local computer 😂😂

@BrianBasor
Copy link

I also receive this same error that appears to be based on the same bug when I run the following command with the Azure CLI from a git bash prompt:

az role assignment create --assignee $spID2 --role 'Contributor' --scope /subscriptions/my-subscription-id/resourcegroups/RG2/providers/Microsoft.Network/networkSecurityGroups/my-nsg-name

Here is the error:

ClientError: Error occurred in request., InvalidSchema: No connection adapters were found for 'C:/Program Files/Git/subscriptions/my-subscription-id/resourcegroups/RG2/providers/Microsoft.Network/networkSecurityGroups/my-nsg-name/providers/Microsoft.Authorization/roleDefinitions?$filter=roleName%20eq%20%27Contributor%27&api-version=2018-01-01-preview'

I guess I'll need to switch over to Powershell for this task.

@mruepp
Copy link

mruepp commented Dec 18, 2020

This Bug is was never solved and should be reopened again. I create a new issue.

@BrianBasor
Copy link

Thank you for creating that issue in the right repo @mruepp ! In case anyone hasn't seen it, here is the link: Azure/azure-cli#16317

@DevKiranOps
Copy link

Just so others who've experienced this issue know, I can confirm the command works fine on WSL. Sad it cant' work on GitBash! Client Utility is supposed to work on a variety of environments and not just cloud shell.

@mruepp
Copy link

mruepp commented Feb 22, 2021

So MSYS_NO_PATHCONV=1 does solve the issue. This issue is solved.

@OAustlid
Copy link

This worked. Great!

@ilyas-it83
Copy link

just set export MSYS_NO_PATHCONV=1

@SreedharBoya
Copy link

just set export MSYS_NO_PATHCONV=1 and it work on Gitbash.This issue is sloved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests