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

Azure CLI in browser from portal results into Bad Request.. #12802

Closed
rfcdejong opened this issue Mar 31, 2020 · 6 comments
Closed

Azure CLI in browser from portal results into Bad Request.. #12802

rfcdejong opened this issue Mar 31, 2020 · 6 comments
Assignees
Labels
Account az login/account Cloud Shell Service Attention This issue is responsible by Azure service team.
Milestone

Comments

@rfcdejong
Copy link

This is autogenerated. Please review and update as needed.

Describe the bug

Using the Azure CLI on my development laptop I didn't get my visual studio to use my account owner account to access my own just created keyvault. I know what I do and had this working many times before on other subscriptions and key vaults. Now it keeps running into 400 invalid resource trying to get an access token.

When I use the CLI on Azure CLI from browser it results into this exception below.

Command Name
az account get-access-token

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 206, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 608, in execute
    raise ex
cli/core/commands/__init__.py, ln 666, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
...
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 account get-access-token --resource {}

Expected Behavior

Environment Summary

Linux-4.15.0-1075-azure-x86_64-with-debian-stretch-sid
Python 3.6.5

azure-cli 2.2.0 *

Extensions:
azure-devops 0.17.0

Additional Context

@yonzhan yonzhan added the Account az login/account label Mar 31, 2020
@yonzhan yonzhan added this to the S169 milestone Mar 31, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Mar 31, 2020

add to S169

@rfcdejong
Copy link
Author

Maybe it is not relavant, but I do have to have to notice that my laptop has been disconnected from one organisation which had Hybrid Azure AD to a new organisation which has no on premises AD, only Managed Identity in Azure AD. Also I'm using my FIDO2 yubikey as MFA enabled in preview for my account. Including authenticate into windows with FIDO2.

@jiasli
Copy link
Member

jiasli commented Apr 1, 2020

Same issue as #11749

400 Client Error: Bad Request for url: http://localhost:50342/oauth2/token is a known issue of Cloud Shell that it intermittently fails with this error.

To solve it, please use Azure CLI on a local machine or run az login in Cloud Shell and retry the command.

@rfcdejong
Copy link
Author

Using Azure CLI on local machine was in #12803 which got resolved because I used the name of the keyvault instead of just a common resourcename which should had been used.

So this is just a followup error as you @jiasli mentioned

@jiasli
Copy link
Member

jiasli commented Apr 1, 2020

Let's keep this issue open. We are working with Cloud Shell team to fix it.

@jiasli jiasli modified the milestones: S169 - For Build, Backlog May 11, 2020
@maertendMSFT
Copy link
Member

This should be fixed now. I cannot repro, please close.

@yonzhan yonzhan closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Cloud Shell Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants