After having preauthorized the Azure CLI for an application object (resource), I often use the following command to fetch a token for the preauthorized scopes (e.g. user_impersonation
):
az account get-access-token --resource api://779d25c3-6c74-4875-b5ae-ef9b5a04b1e8
This works fine!
But consider the case, where I have configured the resouce with permissions for e.g. MS Graph (User.Read
).
In that case, I would like to use Azure CLI to fetch a token for MS Graph using the resource, like I would normally do using the authorization code grant flow, where I would sign-in to the resource and specify a scope of e.g. User.Read
, resulting in an access token for MS Graph.
Is that possible?