Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
md 76 lines 6.21 KB
Rendered Raw
1 ## How do I set up custom OAuth credentials for Dynamics 365?
2
3 Use your own Microsoft Entra ID app registration when you want the Microsoft consent screen to show your app's name and you want to control which permissions Dynamics 365 requests.
4
5 ### Create the Microsoft Entra app
6
7 1. Sign in to the [Azure portal](https://portal.azure.com/), open **App registrations**, and click **New registration**.
8 2. Enter a **Name**. Under **Supported account types**, choose an organizational option: **Accounts in this organizational directory only** (single tenant) or **Accounts in any organizational directory** (multitenant). Dynamics 365 requires a work or school account.
9 3. Under **Redirect URI**, select the **Web** platform, enter `https://backend.composio.dev/api/v1/auth-apps/add`, and click **Register**.
10 4. On the app's **Overview** page, copy the **Application (client) ID**.
11
12 ![Entra app Overview page with the client, object and tenant IDs censored](/images/toolkits/shared/XrRJcE8kllnTRDHzOTTTl8s9oxc.webp)
13
14 5. Open **Certificates & secrets** and click **New client secret**. Add a description, choose an expiry that fits your rotation policy (for example, 180 days), and click **Add**. Rotate the secret before it expires.
15
16 ![Add a client secret panel with a description and the 180-day expiry](/images/toolkits/shared/eZiGGdUoPbOHKz4sCPqGdS04k.webp)
17
18 6. Copy the secret **Value** right away. Use the **Value**, not the **Secret ID**. Azure shows the full value only once; if you lose it, create a new secret.
19
20 ![Client secrets list with the Value and Secret ID columns censored](/images/toolkits/shared/hiQJlSSKAljLV6UM2Wu8e5sUCzU.webp)
21
22 7. Open **API permissions**, click **Add a permission**, select **Dynamics CRM**, and choose **Delegated permissions**. Select `user_impersonation`, then click **Add permissions**. The signed-in user's Dynamics security roles still decide which records they can access.
23
24 ![API permissions page with the Add a permission button](/images/toolkits/shared/O3hvEI521MXY1DbagDCQ8U3W2vo.webp)
25
26 ![Request API permissions panel with Dynamics CRM under Microsoft APIs](/images/toolkits/dynamics365/dynamics-crm-api.webp)
27
28 ![Dynamics CRM delegated permissions with user_impersonation selected](/images/toolkits/dynamics365/user-impersonation-permission.webp)
29
30 ![Configured permissions list with the Dynamics CRM user_impersonation permission](/images/toolkits/dynamics365/configured-permissions.webp)
31
32 8. If your tenant restricts user consent, have a tenant admin click **Grant admin consent for** your tenant on the **API permissions** page. Adding a permission to the app registration doesn't grant consent by itself.
33
34 The redirect URI you register must exactly match the `oauth_redirect_uri` field in your Composio auth config (default `https://backend.composio.dev/api/v1/auth-apps/add`).
35
36 ### Create the auth config in Composio
37
38 1. In the Composio dashboard, go to **Auth Configs**, click **Create**, and select **Dynamics 365**. Enter a config name and click **Next**.
39
40 ![Composio Auth Configs page with the Create button](/images/toolkits/dynamics365/composio-auth-configs.webp)
41
42 ![Create Auth Config dialog with Dynamics 365 selected](/images/toolkits/dynamics365/composio-toolkit-picker.webp)
43
44 ![Auth config name field with the Next button](/images/toolkits/dynamics365/composio-config-name.webp)
45
46 2. Select **OAuth 2.0** and **Your Own Credentials**. Paste the Application (client) ID into **Client id** and the secret value into **Client secret**. Leave **Redirect URI** as shown.
47
48 ![Composio auth config form with OAuth 2.0 and Your Own Credentials selected](/images/toolkits/dynamics365/composio-own-credentials.webp)
49
50 3. Under **Scopes**, keep `offline_access` and use **Add scope** to add the environment-specific Dynamics scope, which uses your full environment URL (for example, `https://yourorg.crm.dynamics.com/user_impersonation`). Click **Create Auth Config**.
51
52 ![Composio scopes list with offline_access selected and a censored environment-specific scope added](/images/toolkits/dynamics365/composio-scopes.webp)
53
54 4. Open the auth config and click **Connect Account**. Enter the organization name (`subdomain`) and environment host (`region`) from your Dynamics URL: for `https://yourorg.crm8.dynamics.com`, enter `yourorg` and `crm8.dynamics.com`. Sign in with a work or school account that has access to the environment, review the **Access Common Data Service as you** permission, and click **Accept**. Leave **Consent on behalf of your organization** unchecked unless you're an admin granting tenant-wide consent. An **unverified** label is expected for a custom app without a verified publisher.
55
56 ![Composio connection form with the Dynamics 365 organization name and environment host fields](/images/toolkits/dynamics365/connection-fields.webp)
57
58 ![Microsoft Pick an account page with the accounts censored](/images/toolkits/shared/1dBnBBEYr17c671yWVLvqnS4k.webp)
59
60 ![Microsoft consent prompt with Access Common Data Service as you and organization consent unchecked](/images/toolkits/dynamics365/microsoft-consent.webp)
61
62 5. Back on the auth config's **Connected Accounts** tab, confirm the account shows **Active**. The **Enabled** label at the top of the page describes the auth config, not the account.
63
64 ![Connected Accounts tab with the Dynamics account showing Active](/images/toolkits/dynamics365/connected-account-active.webp)
65
66 For the general flow, see [custom auth configs](/docs/auth-configuration/custom-auth-configs).
67
68 ### Scopes
69
70 The default auth config requests only `offline_access`, so add the environment's `user_impersonation` scope yourself. See Microsoft's [OAuth with Dataverse](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-oauth) reference.
71
72 ### Connection fields
73
74 - `subdomain` (required): the organization name from your environment URL, such as `myorg` in `https://myorg.crm8.dynamics.com`.
75 - `region`: the host suffix, such as `crm8.dynamics.com`. Keep `crm.dynamics.com` for the default public cloud. Use `crm.microsoftdynamics.us` for GCC High or `crm.dynamics.cn` for China.
76 - The connection's tenant field (`issuer`) defaults to `common`. To restrict sign-in to one tenant, set it to your **Directory (tenant) ID** from the app's **Overview** page or a verified tenant domain.