Skip to content

{Core} Print error details if fail to get msal token#15004

Merged
arrownj merged 1 commit intoAzure:devfrom
arrownj:vmssh_error_details
Sep 7, 2020
Merged

{Core} Print error details if fail to get msal token#15004
arrownj merged 1 commit intoAzure:devfrom
arrownj:vmssh_error_details

Conversation

@arrownj
Copy link
Contributor

@arrownj arrownj commented Sep 1, 2020

Description
Currently if the get_msal_token function fails, it will only print an error "invalid_grant", which is not enough to guide user to do further actions. This PR is to print the error details of it.

Testing Guide
Need to test via vmssh extension.

  1. install vmssh extension
  2. setup vmssh feature in portal
  3. configure condition access for a particular VM
  4. connect to the VM

current behavior:

invalid_grant

expected behavior:

Get token failed. invalid_grant: AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access 'ce6ff14a-7fdc-4685-bbe0-f6afdfcfa8e0'.
Trace ID: 0afea3cd-00af-406b-bbd0-959d217f0b00
Correlation ID: ff9bb588-aee5-4f22-9b02-005d98dbe197
Timestamp: 2020-09-01 06:15:16Z

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

@yonzhan
Copy link
Collaborator

yonzhan commented Sep 1, 2020

Core

response = client.obtain_token_by_refresh_token(refresh_token, scope=scopes, **kwargs)
if "error" in response:
raise CLIError(response["error"])
raise CLIError("Get token failed. {error}: {error_description}".format(**response))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@houk-ms could you pls have a look also?

@arrownj arrownj merged commit b552578 into Azure:dev Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants