In this post, we will have a look at the new recommended way of using the Azure Identity library to authenticate to the Microsoft Graph .NET SDK.
Specifically, we will have a look at Interactive browser based authentication where the user would enter their credentials and the Azure Identity library will fetch the access token based on them.
Before going through the code, let us check out the Azure AD App registration which would be used to authenticate to the Graph API
Since we are going to authenticate from a .NET Desktop console application, we will select Desktop as a platform and add the default redirect URIs. In addition, we will also add http://localhost to the list.
The supported account types can be as per your requirements. I have selected the app to be multi tenant.
Select the needed scopes: