[Microsoft Graph API by using a console app's identity ] Authorization_IdentityNotFound

Duy Huynh 1 Reputation point
2022-02-23T15:05:55.67+00:00

Following an article: https://learn.microsoft.com/en-us/azure/active-directory/develop/console-app-quickstart?pivots=devlang-python
I am pending in step 4: Admin consent
And I have some errors while running the code sample.
177223-image.png
How I can fix it?

Microsoft Security Microsoft Entra Microsoft Entra ID
Microsoft Security Microsoft Authenticator
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    2022-02-24T02:16:39.66+00:00

    Hi @Duy Huynh ,

    Thanks for reaching out.

    From your query I understood that you are getting error when trying to aquire the token using console app's identity.

    This error is generally due to when scopes are not defined correctly or admin consent has not been granted for the defined permissions.

    As per sample , application permissions has been assigned to the application.

    Application permissions has been used when there is no user interaction so these permissions always require admin consent ahead of time where as Delegated permissions has been used where application need to signed in user, in that admin consent is require only for some specific permissions.

    Admin consent can be granted by clicking on Grant Admin consent for {Tenant Name} by navigating to Configured Permissions in Application Registration->Manage-> API permissions

    177393-admingrant.png

    Once Admin consent has been granted, status of the permissions has been changed to granted to access the application and allow your application to get the token with defined scopes and further access the resources based on scopes in the token.

    Hope this will help.

    Thanks,
    Shweta

    ---------------------------------------------------------------------------------------

    Please remember to "Accept Answer" if answer helped you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.