-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Request ms-graph token with scope "calendars.read" #12986
Comments
add to S169 |
add to S171 |
Currently Azure CLI still uses ADAL to authenticate. The first step of authorization code flow is /authorize:
So, Even with our current on-going MSAL migration work, the first step is /authorize:
According to Microsoft identity platform and OAuth 2.0 authorization code flow,
So the initial
I got the same error:
I think it is because Azure CLI is not authorized in the first-party app portal to access scopes like |
Currently without absolute needs, we don't want to extend Azure CLI's pre-authorized permissions. We are considering supporting custom client ID in #22775. A workaround is to create and use your own service principal which has such permissions (#22775 (comment)). |
Describe the bug
Command Name
az account get-access-token
Errors:
When using
--resource-type ms-graph
or--resource
directly to get a token for MS Graph the token generated has limitted scopes to perform actions in the Graph API and the user isn't able to consent to additional scopes (or I couldn't find out how to).For example trying:
az account get-access-token --resource https://graph.microsoft.com/calendars.read
Results in the following error:
Get Token request returned http error: 400 and server response:
Alternatively if you do
az account get-access-token --resource-type ms-graph
then attempt to use the token to retrieve calendar information with:Returns:
While
curl "https://graph.microsoft.com/v1.0/me" -H "Authorization: Bearer $TOKEN"
will work.Looking at the JWT content for the token generated the scopes are as follows:
How can I go about generating a token with additional scopes like
calendars.read
?Attempting to do
UserConsent
flow with something like this (AzureCLI ClientID):Fails with:
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
Expected Behavior
A way to generate a token for user selected scopes, for example to allow calendar information is printed for the user.
In terms of implementation, when requesting a scope which needs consent a dialog/browser could be displayed for the user to consent similar to signin experience.
Environment Summary
Additional Context
The text was updated successfully, but these errors were encountered: