0
votes

I'm using angular 8 and spring boot both applications are deployed in azure app services and using ad authentications. In ui I'm using adal-angular4 lib for getting token details. Using that I can able to get access token using this method .acquireToken('< spring service client Id >') to access my spring application. It is working fine i can able to get the response. but i want to get user details, group information and role details using that access token in spring application. I don't know how to get those details. please any one help me. Thanks

1
You can use Microsoft Graph API to get this information.Gaurav Mantri
Hi, i'm new in azure please explain little bit more. I was tried more then 10 days all the possibilities but I can't.Manihtraa

1 Answers

0
votes

If you want to get the detailed information of Azure AD group or Azure AD user, you can use Microsoft Graph API. For example

Register a new application using the Azure portal

  1. Sign in to the Azure portal using either a work or school account or a personal Microsoft account.

  2. If your account gives you access to more than one tenant, select your account in the top right corner, and set your portal session to the Azure AD tenant that you want.

  3. In the left-hand navigation pane, select the Azure Active Directory service, and then select App registrations > New registration.

Configure Microsoft Graph permissions you need for your application [![enter image description here][3]][3]

Code

     # install package microsoft-graph, microsoft-graph-core, microsoft-graph-auth
        ClientCredentialProvider authProvider = new ClientCredentialProvider(CLIENT_ID, SCOPES, CLIENT_SECRET, TENANT_GUID, NATIONAL_CLOUD);

IGraphServiceClient graphClient = GraphServiceClient
                .builder()
                .authenticationProvider(authProvider)
                .buildClient();

# get group
Group group = graphClient.groups("object")
    .buildRequest()
    .get();
#
IUserCollectionPage users = graphClient.users()
    .buildRequest()
    .get();

For more details, please refer to

https://docs.microsoft.com/en-us/graph/sdks/sdk-installation?context=graph%2Fapi%2F1.0&view=graph-rest-1.0

https://docs.microsoft.com/en-us/graph/overview-major-services