> For the complete documentation index, see [llms.txt](https://developers.didomi.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.didomi.io/integrations/third-party-apps/microsoft-dynamics-365/microsoft-dynamics-365-legacy.md).

# Microsoft Dynamics 365 (Legacy)

{% hint style="success" %}
**Available for:** Preference Management Platform (PMP)

**Premium Feature:** Microsoft Dynamic 365
{% endhint %}

Didomi allows you to update your Microsoft Dynamics 365 Contact attributes with the preferences collected through your Preference Management Platform (PMP).

{% hint style="warning" %}
**Note**: This article is currently maintained for existing organizations that have implemented the Microsoft Dynamics 365 (Legacy) integration with Didomi. These organizations are strongly encouraged to [update and migrate their integration](/integrations/third-party-apps/microsoft-dynamics-365/microsoft-dynamics-365-current.md) to utilize the current iteration of the Didomi/Microsoft Dynamics 365 integration
{% endhint %}

## Implementation

### **Connection**

Didomi connects to Microsoft Dynamics Dataverse on your behalf through the following parameters:

* Client ID
* Client secret
* Server instance
* Azure tenant ID

### **Options**

**Upsert mode**

You can choose allowing Didomi to create contact in Microsoft Dynamics 365, by setting `upsert_mode` to true. Otherwise, when a consent is collected but the `organization_user_id` value does not match with any contact in Microsoft Dynamics 365, the consent update will not be propagated.

### **Mapping**

Didomi uses the entity contact of Microsoft's Dataverse and sends the contact attribute property when updating a contact. Hence consent events are mapped to Microsoft Dataverse's contact attributes.

## Configuration

| Property        | Description                                                                               | Required                  |
| --------------- | ----------------------------------------------------------------------------------------- | ------------------------- |
| Client ID       | A client ID of the created Azure Enterprise application                                   | Yes                       |
| Client secret   | A client ID of the created Azure Enterprise application                                   | Yes                       |
| Azure tenant ID | Tenant ID of your Azure app settings                                                      | Yes                       |
| Server Instance | Your REST API endpoint                                                                    | Yes                       |
| Upsert mode     | By setting upsert\_mode to true you allow Didomi to create contacts in Microsoft Dynamics | No, Default value = false |
| Mappings        | Mapping for properties between Didomi and Microsoft Dynamics Dataverse                    | Yes                       |

### Example

```javascript
{
    "type_id": "microsoft-dynamics",
    "authentication": {
        "client_id": "your_client_id",
        "client_secret": "your_client_secret",
        "tenant_id": "your_azure_app_tenant_ID",
	      "instance": "your_rest_api_endpoint"
    },
    "properties": {},
    "mappings": [
        {
	    "id": "dataverse_contact_attribute_logical_name",
	    "value": "consents_purposes_newsletter_enabled"
	}
    ],
    "upsert_mode": true
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.didomi.io/integrations/third-party-apps/microsoft-dynamics-365/microsoft-dynamics-365-legacy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
