Microsoft Graph + Power Automate = M365 data with no code!

Microsoft Graph provides a single endpoint to get connected with M365 data. We know that Power Automate has many built-in MS Graph components to access Outlook, Planner, Calendar and more. But, think about calling Microsoft Graph API with custom filters from Power Automate directly! It is even more exciting and gives us more flexibility and numerous automation possibilities with no-code. Today, our scenario is to get “members” of a particular group in 3 quick steps.

Step 1: Register an application in Azure Active Directory

  • Go to Azure Portal.
  • Under Azure Active Directory, go to App Registration and click on New Registration.
  • Give a name to your app, choose the access level and hit Register button.
  • Go to API permissions tab, click on Add a permission, select Microsoft Graph and then Application permissions, add the following permissions: “Group.Read.All”, “Group.ReadWrite.All”, “User.Read.All”, “GroupMember.ReadWrite.All”, “User.ReadWrite.All”, “Directory.ReadWrite.All”.
  • After creating the permissions, we need to grant consent to the application to allow the application to access Graph API.
  • Go to Certificates & secrets and create a new client secret and copy in a notepad.
  • Finally, go to Overview tab, copy Application (client) ID and Directory (tenant) ID to a notepad, we will need it later.

Step 2: Build Power Automate Flow

  • Go to Microsoft Power Automate Portal.
  • Click on Create tab and choose Instant flow.
  • Give a flow name and choose When an HTTP request is received as a trigger of the flow, then click Create.
  • Extend When a When an HTTP request is received block and click on Use sample payload to generate schema, then add the following schema:
    "type" : "object",
    "properties" : {
       "groupId" : {
          "type" : "string"
  • Then click Save.
  • Click New Step and add Initialize variable with the following details:
    • Name: application_id
    • Type: string
    • Value: AAD App – Application (Client) Id
  • Click New Step and add Initialize variable with the following details:
    • Name: directory_id
    • Type: string
    • Value: AAD App – Directory (Tenant) Id
  • Click New Step and add Initialize variable with the following details:
    • Name: secret
    • Type: string
    • Value: AAD App secret
  • Click New Step and add HTTP with the below details:

Step 3: Test the Flow with Microsoft Graph Explorer and Postman

  • Go to Microsoft Graph Explorer.
  • Sign-in with your account.
  • Find all groups under my organization under Sample queries and click on it.
  • Copy one of the group ids for the testing purposes, we will use it in.
  • You may use Postman for testing purposes, and specify the following details:
    • Method: Post
    • Endpoint: copy it from the first step of your flow (When a HTTP request is received)
    • Header:
      • Key: Content-type
      • Value: application/json
    • Body: { “groupId” : “copied-groupid-from-GraphExplorer“}
  • Run test from Power Automate and send the post request from Postman.

After the successful flow, we should receive the output with all the members’ information in Json format under HTTP block.


– Ayca

Published by

Leave a Reply

%d bloggers like this: