Microsoft Graph API in Power Automate

Introduction: In this blog, we will understand how we can use Microsoft Graph API in Power Automate. (MS Flow)

Steps to be followed:

To use Microsoft Graph API in Power Automate we have to register an app in Azure.

Steps to Register an App:

  1. Sign in to https://portal.azure.com/
  2. Search and select App Registrations
  1. Click on “+New Registration”
  1. Enter Name, Select the Account type, Keep Redirect URI blank and click on Register.
  1. Once your app is created, Go to API permissions and click on “+Add a permission“.
  1. Select Microsoft Graph
  1. Select Application permissions
  1. Select the permissions based on requirement and click on Add permissions.
  1. After adding permission click on Grant admin consent
  1. Create Client Secret.
  • Go to “Certificates & secrets” and click on “+New client secret”.
  • Enter name, select the expiry and click on Add.
  • Copy the value
  1. Go to overview section and copy the values of Application (client) Id and Tenant Id.

Using Microsoft Graph API in Power Automate

  1. Search and Select “HTTP” action.
  1. Enter Details:

In this example, we will retrieve all the Group members of Group.

  • Method: GET
  • URI: https://graph.microsoft.com/v1.0/groups/<group Id>/members?$select=id,displayName,mail
  • Authentication: Select “Active Directory OAuth” as Authentication type.
  • Paste the values of Tenant,Client Id and secret which we copied from azure app.

Audience: https://graph.microsoft.com

Entire Flow:

Result:

NOTE: You can use Graph Explorer to test and identify what permissions are required to run the query.

https://developer.microsoft.com/en-us/graph/graph-explorer

Microsoft Document on Graph API: https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http

Leave a Reply

Your email address will not be published. Required fields are marked *