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.

Cannot create service principal

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az ad sp create-for-rbac

I ran this and got the below error. The 2 variables referenced did indeed have the correct value: ARM_CLIENT_SECRET=$(az ad sp create-for-rbac
–name http://ansible-sp-$UNIQUE_ID
–role Contributor
–scopes “/subscriptions/$ARM_SUBSCRIPTION_ID”
–query password
–output tsv)

Errors:

400 Client Error: Bad Request for url: http://localhost:50342/oauth2/token
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 215, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 654, in execute
    raise ex
cli/core/commands/__init__.py, ln 718, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 709, in _run_job
    cmd_copy.exception_handler(ex)
...
python3.6/site-packages/msrestazure/azure_active_directory.py, ln 486, in get_msi_token
    result.raise_for_status()
python3.6/site-packages/requests/models.py, ln 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:50342/oauth2/token

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az ad sp create-for-rbac --name {} --role {} --scopes {} --query {} --output {}

Expected Behavior

Environment Summary

Linux-4.15.0-1089-azure-x86_64-with-debian-stretch-sid
Python 3.6.10
Installer: DEB

azure-cli 2.7.0

Additional Context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
yungezzcommented, Jun 22, 2020

Thanks @djcornutt . This is a known issue in Cloudshell due to #11749. Cloudshell team is working on it. A workaround is to run az login again.

0reactions
msftbot[bot]commented, Jun 22, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @maertendMSFT.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot create service principal from Azure Portal once it's ...
The issue is I, as a global admin/Applicaion admin, cannot "Create Service Principal" once its deleted.
Read more >
Could not create a service principal with the right permissions
1 Answer 1 ... Your login account should has Owner or Contributor role for your subscription. You could check it on Azure Portal....
Read more >
Create a Service Principal to create and manage other ...
First, you need to create the 'administrator' service principal. I'm using the built-in Owner role for this, but you would be wise to...
Read more >
Create a Microsoft Azure service principal
By default, an Microsoft Azure service principal has the Contributor role. The Contributor role cannot assign policy to a resource group. Assign the...
Read more >
Configuring a User or Service Principal to manage Azure ...
Azure Active Directory permissions ... Now that you have created and authenticated an Application / Service Principal pair, you will need to grant...
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