Introduction

Integrating external applications with Microsoft Dynamics 365 CRM can be efficiently managed using Power Automate. In this article, we will walk through the process of setting up an HTTP trigger in Power Automate to receive requests from an external application, authenticate using a JWT token, and perform operations in D365 CRM.

Prerequisites

Before proceeding, ensure you have the following.

Step 1. Register an Application in Microsoft Entra ID.

To enable external applications to authenticate and interact with Power Automate, follow these steps.

Step 2. Create a Power Automate Flow with HTTP Trigger.

Go to https://make.powerautomate.com

Create

Add a trigger When an HTTP request is received.

HTTP request

Select Specific users in my tenant.

Select Specific users

Paste the Object ID.

Paste the Object ID

Parameters

Give a sample JSON that you want to get as a request from the External Application.

External Application

{
    "firstname": "Muhammad",
    "lastname": "Asif"
}

Parameter HTTP

Add New Step Add a new row.

Add a new row

Save the flow and then copy the updated URL from the Step.

Updated URL

HTTP URL

Step 3. Generate JWT Token Using Postman.

To authenticate requests, generate a JWT token using Postman.

  1. Open Postman and create a new POST request.
  2. Set the request URL to: https://login.microsoftonline.com/{TenantID}/oauth2/v2.0/token
  3. In the Body, select form-data and add the following fields.
    • grant_type: client_credentials
    • client_id: Your registered application's Client ID
    • client_secret: The generated Client Secret
    • scope: https://service.flow.microsoft.com//.default
  4. Click Send and copy the access_token from the response.
    Send
    Access_token

Step 4. Test the Power Automate Flow.

  1. In Postman, create a new POST request to the Power Automate URL generated earlier.
  2. Add the following headers.
    • Authorization: Bearer {access_token}
  3. Define the Body payload matching the request schema in Power Automate.
  4. Click Send and verify if Power Automate receives the request.

Add JSON into the request body.

Add JSON

Add Authorization Header and Add Bearer Token.

Bearer Token

Execute the API call from POST Man.

POST Man

Step 5. Perform Operations in D365 CRM.

Once Power Automate receives the request, it can process it to interact with D365 CRM using the Dataverse connector.

Create a record: Use the "Add a new row" action to insert data.

Now go to the Power Automate Run History.

 Power Automate Run History

The request is received successfully.

Request is received

The record is created into CRM Dataverse successfully.

CRM Dataverse

Conclusion

Integrating an external application with D365 CRM using Power Automate and Microsoft Entra ID provides a secure and efficient way to automate CRM interactions. By leveraging HTTP triggers and JWT authentication, you can seamlessly perform CRUD operations within D365 CRM. This approach enhances automation, improves data consistency, and streamlines business workflows, making it a powerful solution for integrating third-party applications with Dynamics 365 CRM.