This repo is heavily based on this MS example: https://docs.microsoft.com/en-us/graph/tutorials/dotnet-core but tweaked slightly to get all AAD groups for a user.
- Read through the tutorial above.
- Follow the tutorial steps above to setup a new App registration in Azure AD for your new console app.
- Within the portal settings for the app, under Authentication setup a new 'Mobile and desktop applications' platform configuration. Use the settings in the tutorial.
- Under API premissions, make sure to add MS Graph - Delegated permissions for User.Read and Directory.ReadAll
- Matching those to your user-secrets within VS locally:
{
"scopes": "User.Read;Directory.Read.All;",
"appId": "YOUR-APP-ID-GUID"
}
- Run the app, it will prompt you to authenticate via https://microsoft.com/devicelogin and provide a code to use.
- Once authenticated, choose 1 or 2 from the menu options of the console app to view the Group IDs or Group Names for the user within AAD e.g.