WPF application signing in users with Microsoft and calling the Microsoft Graph
This simple sample demonstrates how to use the Microsoft Authentication Library (MSAL) for .NET to get an access token and call the Microsoft Graph (using OAuth 2.0 against the Azure AD v2.0 endpoint).
Steps to Run
You can get full explaination about this sample, and build it from scratch by going to Windows desktop .NET guided walkthrough.
If you just want to quickly run it, use the following instructions:
Register an Azure AD v2.0 (converged) app.
- Navigate to the App Registration Portal.
- Go to the the
My Appspage, click
Add an App, and name your app.
- Set a platform by clicking
Add Platform, select
- Copy to the clipboard your Application Id
Clone the code.
git clone https://github.com/Azure-Samples/active-directory-dotnet-desktop-msgraph-v2.git
App.xaml.csfile, set your application/client id copied from the App Registration Portal.
private static string ClientId = "[Application Id pasted from the application registration portal]"
Run the application from Visual Studio (Debug | Start without Debugging)
Community Help and Support
We use Stack Overflow with the community to provide support. We highly recommend you ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before. Make sure that your questions or comments are tagged with [msal.dotnet].
If you find and bug in the sample please raise the issue on GitHub Issues.
If you find a bug in msal.Net, please raise the issue on MSAL.NET GitHub Issues.
To provide a recommendation, visit our User Voice page.
If you'd like to contribute to this sample, see CONTRIBUTING.MD.