How can I get an Access Token to use Microsoft Graph in the Microsoft Tenant?

Anonymous
2023-07-27T21:46:34.75+00:00

Hello Friends,

I have been collecting some Experience in writing Line of Business Applications with MSAL and the C# SDK in Blazor, Maui and ASP.NET Core Web Api that include Microsoft Graph to create Outlook Appointments aswell as Planner or ToDo Tasks, among other Things. I have been successfully using Delegated and Application Permissions to obtain OAuth2 Tokens to call Microsoft Graph and I love the Possibilities that the Microsoft Graph Api is opening up to create rich User Experiences.

For all the Applications I used so far, I created an Azure AD Tenant in the Azure Portal and created an App Registration there. Then, I use a User Account from that Tenant to log into my App and everything works as expected. I can create Tasks or Appointments, but of course I only see them when I log into Outlook, Planner or ToDo with an Account from that Tenant I created myself.

But now I want to create an app, that can access Microsoft Graph for my own personal Microsoft Account (...@live.de or ...@live.com or ...@microsoft.com Account), so it can add Tasks to a List in my personal Microsoft ToDo. In the scenarios I implemented so far, I am the Tenant Owner, so I can log into the Azure Portal, register an Application and add the required Graph Permissions. But that won't work in the Microsoft Tenant of course. So is there any way to get an Access Token and implement this Scenario? Any help is appreciated.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 30,296 Reputation points Microsoft Employee Moderator
    2023-07-31T08:21:49.4466667+00:00

    Hi @Anonymous ,

    Thanks for reaching out.

    To access the application from personal Microsoft account, you need to register your application with account type " Accounts in any organizational account and personal Microsoft accounts (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)" which will allow a user to sign in to your application with their native identity from any Azure AD tenant/Entra or consumer account.

    Your application can use the organization endpoint or the common endpoint to sign in users in this scenario.

    https://learn.microsoft.com/en-us/security/zero-trust/develop/identity-supported-account-types

    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.