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:
- Sign in to https://portal.azure.com/
- Search and select App Registrations
- Click on “+New Registration”
- Enter Name, Select the Account type, Keep Redirect URI blank and click on Register.
- Once your app is created, Go to API permissions and click on “+Add a permission“.
- Select Microsoft Graph
- Select Application permissions
- Select the permissions based on requirement and click on Add permissions.
- After adding permission click on Grant admin consent
- 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
- Go to overview section and copy the values of Application (client) Id and Tenant Id.
Using Microsoft Graph API in Power Automate
- Search and Select “HTTP” action.
- 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.
NOTE: You can use Graph Explorer to test and identify what permissions are required to run the query.
Microsoft Document on Graph API: https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http