-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Core] Unify ADAL and MSAL error handler #17072
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
Conversation
|
Exposing the original error message is the same behavior as logging in in the browser. For example, with invalid - 04b07795-8ddb-461a-bbee-02f9e1bf7b46
+ 04b07795-8ddb-461a-bbee-02f9e1bf7b41
^ |
|
Core |
| except AttributeError: | ||
| # In case of AdalError created as | ||
| # AdalError('More than one token matches the criteria. The result is ambiguous.') | ||
| raise CLIError(str(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use one of the new Error Types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, raising UnknownError for now and also providing comment and a recommendation:
azure-cli/src/azure-cli-core/azure/cli/core/adal_authentication.py
Lines 255 to 259 in c62df4d
| # In case of AdalError created as | |
| # AdalError('More than one token matches the criteria. The result is ambiguous.') | |
| # https://github.com/Azure/azure-cli/issues/15320 | |
| from azure.cli.core.azclierror import UnknownError | |
| raise UnknownError(str(err), recommendation="Please run `az account clear`, then `az login`.") |

Description
Refine the error message reported by #16209, #16641, #17142.
In the current code, wrapping
adal.AdalErrorand rephrasing the error message actually doesn't provide more information. Instead, it leaves the original server error unexposed.AADSTS70008AADSTS50079AADSTS50173This PR
adal.AdalErrorinAuthenticationErrorwith the original server error unchangedaz logininstruction asrecommendationTesting Guide
Test expired refresh token
az loginwith the user that is managed by the policyaz group listoraz account get-access-tokenError message