Getting Group owners using MS Graph API in Power Automate

The call is made using the MS Graph API call.

https://docs.microsoft.com/en-us/graph/api/group-list-owners?view=graph-rest-1.0&tabs=http

Q:How does the MS Graph API work?

A: The following are the steps.

  1. Register an Azure AD app with the following API permission granted and consented.
Microsoft Graph (2)
     - Group.Read.All
     - User.Read.All

2. Using the REST API to get the Access Token.

POST https://login.microsoftonline.com/<<<Guid for tenant>>>/oauth2/v2.0/token

REQUEST BODY:

grant_type=client_credentials&client_id=<<Azure AD App ID>>&client_secret=<<<the secret>>> &scope=https%3A%2F%2Fgraph.microsoft.com%2F.default

RESPONSE BODY:

{

“token_type”: “Bearer”,

“expires_in”: 3599,

“ext_expires_in”: 3599,

“access_token”: “<<blah blah long string>>”

}

  1. Using the above access token make a call to get the owners.

GET https://graph.microsoft.com/v1.0/groups/<<GuidforGroup>>/owners

It will give the data response as the following.

{

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.user",
"id": "12d7bb75-763b-4103-a367-e6fa9ca0edaa",
"businessPhones": [
   "8005555555"
],
"displayName": "MOD Administrator",
"givenName": "MOD",
"jobTitle": null,
"mail": "admin@TenantName.OnMicrosoft.com",
"mobilePhone": "555-555-5555",
"officeLocation": null,
"preferredLanguage": "en-US",
"surname": "Administrator",
"userPrincipalName": "admin@TanantName.onmicrosoft.com"
}
]
}

Q: How to make such calls from Power Automate?

A: Here is the answer in the link below.

https://www.infopulse.com/blog/using-microsoft-graph-api-inside-microsoft-flow-office-365/

About Pankaj

I am a Developer and my linked profile is https://www.linkedin.com/in/pankajsurti/
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s