Hi! I'm here to help!
Chatbot Icon
Latest Highlights
🏆 ITKnocks places 6th in the CRN Fast50
🎖️ We are now Microsoft Solutions Partner - Business Applications
🏆 ITKnocks places 6th in the CRN Fast50

Integrate External Application with D365 CRM

By Muhammad Asif

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.

  • Access to Microsoft Entra ID (formerly Azure AD)
  • Power Automate license
  • D365 CRM instance
  • Postman for testing API requests

Step 1. Register an Application in Microsoft Entra ID.

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

  • Go to Microsoft Entra ID in the Azure portal.
  • Navigate to App registrations and click New Registration.
  • Enter a name for your application and select the supported account type.
  • Once registered, note down the Client ID.
  • Under Certificates & secrets, generate a new Client Secret and copy its value.
  • Navigate to Enterprise applications, find your registered app, and note down the Object ID.
Integrate External Application with D365 CRM
Integrate External Application with D365 CRM
Integrate External Application with D365 CRM
Integrate External Application with D365 CRM
  • Copy the Client ID.
Integrate External Application with D365 CRM
  • Create Client Secrete from here.
Integrate External Application with D365 CRM
Integrate External Application with D365 CRM
  • Add the Secret.
  • Copy the Secret else it will not be visible after a few minutes.
Integrate External Application with D365 CRM
  • Go back to Entra ID and copy the Tenant ID as well.
Integrate External Application with D365 CRM
  • Now, we have to get the Object ID from the Enterprise Application.
Integrate External Application with D365 CRM
Integrate External Application with D365 CRM

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

  • Go to Power Automate.
  • Click Create and select Instant Cloud Flow.
  • Choose When an HTTP request is received as the trigger.
  • Define the request schema based on the expected payload.
  • Under Settings, go to Allowed Users and paste the Object ID obtained from Entra ID.
  • Save the flow to generate a unique HTTP POST URL.

Go to https://make.powerautomate.com

Integrate External Application with D365 CRM

Add a trigger When an HTTP request is received.

Integrate External Application with D365 CRM

Select Specific users in my tenant.

Integrate External Application with D365 CRM

Paste the Object ID.

Integrate External Application with D365 CRM
integrate external application with d365 crm

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

Integrate External Application with D365 CRM
				
					{
    "firstname": "Muhammad",
    "lastname": "Asif"
} 
				
			
Integrate External Application with D365 CRM

Add New Step Add a new row.

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

Integrate External Application with D365 CRM
Integrate External Application with D365 CRM

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.
Integrate External Application with D365 CRM
Integrate External Application with D365 CRM

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.

Integrate External Application with D365 CRM

Add Authorization Header and Add Bearer Token.

Integrate External Application with D365 CRM

Execute the API call from POST Man.

Integrate External Application with D365 CRM

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.

Integrate External Application with D365 CRM

The request is received successfully.

Integrate External Application with D365 CRM

The record is created into CRM Dataverse successfully.

Integrate External Application with D365 CRM

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.

Let's Shape the
Future Together!

At ITKnocks, we are more than an IT consulting company; we’re your strategic partner in business evolution. With a global footprint and a passion for technology, we craft innovative solutions, ensuring your success. Join us on a journey of excellence, where collaboration meets cutting-edge IT expertise.