# Microsoft Dynamics 365 data source configuration

Orbit Connect can ingest data from your Microsoft Dynamics 365 Web API by connecting via OAuth.

> [!NOTE]
>
> For end-user documentation in Orbit Connect, see [Microsoft Dynamics 365 data source](<https://help.apteco.com/en/orbit/connect/data-sources/ms-dynamics/index.md>).

## Prerequisites

You must register your application within your Azure tenant with the appropriate permissions to access Dynamics 365. You need to obtain the application name and other details from the administrator of your Azure tenant. Use these to configure an MS Dynamics data source within Orbit Connect.

If you don't have a web application registered, complete the registration step first.

## Registering a web application in Azure

1. Log in to [https://portal.azure.com](<https://portal.azure.com>).
2. Navigate to **Microsoft Entra ID** \> **Manage** \> **App registrations**.
3. Select **\+ New registration**.
4. Complete the required details:

   - Enter a name for the application.
   - Choose **Web** in the **Redirect URI (optional)** section.
5. Select **Register**.
6. **Add a certificate or secret** to the app.

   - Select **\+ New client secret**.
   - Enter a description, choose an expiration time, and select **Add**.

   Azure displays the secret on screen as the **Value**. Copy it immediately using the copy function.

   > **Note**
   >
   > The value is only shown once.
7. To assign permissions so the app can access Dynamics 365, select **API Permissions**.
8. Select **\+ Add a permission**, then choose **Dynamics CRM** from the Microsoft APIs shown.
9. Select the option to enable **user impersonation**.
10. Select **Add permissions**.
11. Create a user and assign the app in the Power Platform admin centre: [https://admin.powerplatform.microsoft.com/](<https://admin.powerplatform.microsoft.com/>)

## Finding your Azure tenant ID

1. Log in to [https://portal.azure.com](<https://portal.azure.com>) using your Microsoft credentials.
2. In the search box, type **tenant** and choose **Tenant Properties** from the results.
3. Copy the **Tenant ID** to your clipboard.

## Finding the application ID and client secret

If you've already registered a web application in Azure:

1. Log in to [https://portal.azure.com](<https://portal.azure.com>).
2. In the Azure services section, select **Microsoft Entra ID**.
3. Search for the name of the application configured for this purpose (for example, **MS Dynamics 365 Sandbox**).
4. Select the listing that shows **Application** (not **Service Principal**).
5. Copy the **Application (client) ID**.
6. Copy the **Directory (tenant) ID**.
7. Select **Client Credentials** to view the **Client Secret** (stored as the Value parameter). If you haven't recorded this, create a new client secret using the highlighted option.

## Obtaining the Dynamics 365 instance URL

The instance URL comes from the start of the address shown when you log into Dynamics 365.

In this case the instance URL is the start of the address up to and including `.com`: `https://aptecodev.crm11.dynamics.com`
