3 steps to integrate Microsoft Dynamics 365 Sales using Web API
Tags: tutorial, api, dynamics365, nativeintegration
Published: 2023-01-28 17:01:09

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/dynamics365-how-to-connect.png)

This blog will act as a reference for creating an OAuth web application for [Microsoft Dynamics 365 Sales](https://dynamics.microsoft.com/en-us/sales/overview/) to interact with the Web API. We have done the grunt work and have listed out _just_ the resources you need to integrate.**

> If you looking to natively integrate with all leading CRMs such as HubSpot, Close, Pipedrive, Freshsales, and Copper, use Truto.one for free. It’s built for developers by developers to natively integrate all CRMs in one go.

> :warning: This post is not an in-depth tutorial on how to build OAuth apps in general, some prior knowledge of how OAuth apps work is required.

## Prerequisites

You'd need a `onmicrosoft.com` account. If you don't have one, signup [here](https://go.microsoft.com/fwlink/?LinkId=2139837&clcid=0x409).

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.38.50-1.png)
_Signup flow for Dynamics 365 Sales Premium Trial_

At the end of the signup flow, you will end up at the [Power Platform admin center](https://admin.powerplatform.microsoft.com/). Just click "Cancel" when prompted to create an Environment.

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.44.32.png)
_Power Platform admin center_

## Sign up for Dynamics 365 Sales

1. Visit [Dynamics 365 Sales Free Trial page](https://dynamics.microsoft.com/en-us/dynamics-365-free-trial/) and click on Try for free.
2. Enter your `onmicrosoft.com` email and click "Start your free trial".

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.47.05.png)
_Dynamics 365 Sales Free Trial Signup_

## Create an application on Azure AD

1. Visit the [App registration page](https://go.microsoft.com/fwlink/?linkid=2083908) on Azure AD
2. Click "New Registration"

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.50.01.png)
_Click New registration to start creating new OAuth app_

3. Enter in the details of the app, with the redirect URI.

4. Select the account type based on whether you want to make this OAuth app available to others (Multitenant) or if you want to use it only in your organization (Single tenant).

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.53.26.png)
_Confirm the details before submitting_

5. Submit the form by clicking "Register"

6. You can get your OAuth Client ID in the Overview tab, copy and store it somewhere.

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.54.42.png)
_OAuth Client ID is present in the Overview tab_

7. On the app details page, click "Manifest" on the sidebar and change the value of  `allowPublicClient` in the JSON editor to `true`

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.57.24.png)
_Update the manifest to allow public clients_

8. Click "API permissions" and click "Add a permission"

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.55.49.png)
_Click Add a permission to add Dynamics CRM permission_

9. Select "Dynamics CRM"

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.56.02.png)
_Select Dynamics CRM or search for it in the "APIs my organization uses" tab_

10. Check "user\_impersonation" permission and click "Add permissions" at the bottom.

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.56.21.png)
_Select user_impersonation permission and save by clicking Add permissions_

11. You can also grant admin consent for your organization by clicking, "Grant admin consent for ..."

12. Click "Certificates & secrets" and click "New client secret"

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.54.59.png)
_Create an OAuth Client Secret_

13. Enter a friendly name for the secret and click "Add"

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.55.19.png)
_Enter a name and select the expiry duration_

14. You will be shown the Client Secret for the OAuth app, copy it and store it somewhere safe.

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-11.55.33.png)
_Copy over the Client Secret_

Post creating an OAuth application, you can either use Microsoft's [Authentication libraries](https://learn.microsoft.com/en-us/azure/active-directory/develop/reference-v2-libraries#web-application) to add OAuth flow into your web application or any other OAuth client library, you can find the OAuth URLs and flows [here](https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow).

**IMPORTANT** : When doing OAuth flow using a non-Microsoft library, add the Web API endpoint (which you'll find in the next section) as part of the scope. For example, if your Web API endpoint is **`https://abcd.api.crm.dynamics.com/`** , then add the following to the `scope` parameter -> **`https://abcd.api.crm.dynamics.com/.default`**

You can also test out the Dynamics 365 Sales API using Postman by following the instructions [here](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/setup-postman-environment?view=dataverse-latest).

## Get your Web API Endpoint

1. Visit [Power Apps](https://make.powerapps.com/) dashboard.
2. Click the Environment selector on the top right and select the "Sales Trial" environment. This environment is created when you sign up for the trial of Dynamics 365 Sales on the first step.

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-12.07.45.png)
_Select the Sales Trial environment_

3. Click the Cog icon beside the Environment selector and click "Developer resources"

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-12.07.57.png)
_Select Developer resources under the cog menu_

4. The Web API endpoint will be listed.

![3 steps to integrate Microsoft Dynamics 365 Sales using Web API](https://truto.one/blog/content/images/2023/01/Screenshot-2023-01-11-at-12.08.12.png)
_Make a note of your Web API URL_

For information on how to make requests, refer the guide by Microsoft [here](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-data-web-api?view=dataverse-latest).

For information about the entities of Dynamics 365 Sales, refer the [Web API reference](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/about?view=dataverse-latest).

Following these steps will you put on the right path to integrating Microsoft Dynamics 365 Sales CRM.

If you have any questions or run into a roadblock, feel free to reach out to us at [support@truto.one](mailto:support@truto.one), we’ll be happy to help.

Are you looking to natively integrate with all leading CRMs such as HubSpot, Close, Pipedrive, Freshsales, and Copper? Use [Truto.one](https://truto.one) for free. It’s built for developers by developers to natively integrate all CRMs in one go.

## Build +200 native integrations

> Using Truto's Unified API for CRM, Unified API for ATS, Unified API for HRIS, Unified API for Accounting, and 26 other categories
[Get started free](https://truto.one/?ref=dynamics365salesdevto)