How To Access Microsoft Teams Graph API In Power Automate

Graph API can be used to automate the Microsoft Teams lifecycle such as creating teams, channels, adding members, etc.

Refer to this link to see the list of Graph APIs available for Microsoft Teams.

You will see how to retrieve all the teams by calling Graph API in flow.

The list of all teams is here.

In this article, you will see how to perform the following tasks,

  • Register an Application in Azure - Register an app in Azure AD and add the required permissions to access the Graph API
  • Create flow: Access Teams Graph API Create an Automation Account

Register an application in Azure

Register an application in Azure AD to access the Teams Graph API.

  1. Navigate to the Azure portal.
  2. Search for App Registrations. Click App Registrations as shown below.
  3. Click New Registration.
    App registrations
  4. Enter the Name and click Register.
    Register an application
  5. App registered successfully. In the left navigation, click API Permissions.
    API permission
  6. Click Add a permission.
    Add permissions
  7. Select Microsoft Graph API as shown below.
    Request API permission
  8. Click Application Permissions.
    Request API permission
  9. SelectRead.All permissions and click Add permissions.
    Add permission
  10. Click Grant admin consent.
    Click grant admin consent
  11. In the left navigation, click Overview. Copy the Application (client) ID and Directory (tenant) ID values. These values will be used in Flow for authentication.
    Access graph API
  12. In the left navigation, click Certificates & secrets. Click New client secret.
    New client secret
  13. Enter the description and click Add.
    Add a clien secret
  14. Copy the secret value which will be used in flow for authentication.
    New client secret

Create Flow

The following trigger (manually starts) and actions will be used in this flow.

Manually trigger

  1. Navigate to Power Automate portal.
  2. Create a new flow.
  3. Trigger: Manually trigger a flow.
  4. Action – Initialize Variable (renamed as Directory ID): Copied from App Registration overview page (Directory (tenant) ID) – refer to step 11 in the previous section.
    Directory ID
  5. Action – Initialize Variable (renamed as Application ID): Copied from App Registration overview page (Application (client) ID) – refer to step 11 in the previous section.
    Application ID
  6. Action – Initialize Variable (renamed as Secret): Refer to step 14 in the previous section.
  7. Action – Initialize Variable (renamed as URI): Graph API URI -$filter=resourceProvisioningOptions/Any(x:x eq 'Team')&$select=displayName
  8. List all teams here.
  9. Action  HTTP: Configure HTTP action as shown below.
  10. Enter the name for the flow and save it.
    Access graph API
  11. Click Test to test the flow. Click Run flow.
  12. Flow ran successfully.
  13. JSON Output:Listed all the teams within the tenant.
      "@odata.context": "$metadata#groups(displayName)",  
      "value": [  
          "displayName": "M365Chennai"  
          "displayName": "Events2020"  
          "displayName": "Demo"  
          "displayName": "Tech Reads"  
          "displayName": "Automation Testing"  


Thus, in this article, you saw how to access Microsoft Teams Graph API in Power Automate.

Similar Articles