> For the complete documentation index, see [llms.txt](https://docs.harmony.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.harmony.io/integrations/saas-applications/microsoft-dynamics.md).

# Microsoft Dynamics 365

Discover who holds a Dynamics 365 seat in each environment, with their license, security roles and last activity

Microsoft Dynamics 365 is Microsoft's family of CRM apps (Sales, Customer Service, Field Service and more) running on Dataverse. The Microsoft Dynamics 365 integration connects your Microsoft tenant to Harmony and shows, for each Dynamics environment, who holds a seat, which Dynamics license they hold, and whether they still use it. Each environment you connect (production, sandbox, and so on) appears as its own instance of Microsoft Dynamics 365 in Application Management.

#### What the Microsoft Dynamics 365 integration enables

| Capability                 | Description                                                                                                       |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| License Optimization       | Find users who hold a paid Dynamics 365 license but no longer open the environment, and reclaim the seat          |
| Per-Environment Visibility | See users, roles and activity separately for each environment, so production and sandbox seats are never mixed up |
| License Tier Visibility    | See which Dynamics 365 license each user holds (Sales Enterprise, Customer Service, Team Members, and others)     |
| Access Review              | See each user's security roles, business unit and access mode, and who is a System Administrator                  |
| Activity Monitoring        | Last activity and an activity trend per user, from each environment's Dataverse audit log                         |

***

#### Prerequisites

1. **Microsoft Entra Global Administrator or Privileged Role Administrator** - admin consent is required, because Harmony uses application (app-only) permissions rather than acting as a signed-in user.
2. **Power Platform administrator or System Administrator in each environment** - to add Harmony as an application user and give it a security role.
3. **The URL of each environment** you want to sync, from the **Power Platform admin center**.
4. **Auditing with Log access turned on** in each environment, for activity data. Without it, users and licenses still sync but activity stays empty.
5. **A Harmony account** with admin privileges.

{% hint style="warning" %}
**Cloud availability:** this integration supports Dynamics 365 environments in the global Microsoft cloud (`*.crm.dynamics.com`, `*.crm4.dynamics.com`, and the other regional `crm` hosts). US Government (GCC High / DoD) and 21Vianet China environments are not supported.
{% endhint %}

{% hint style="info" %}
**Not covered:** Dynamics 365 Finance, Supply Chain Management, Commerce, Human Resources and Business Central don't run on Dataverse. Their licenses aren't counted as Dynamics 365 seats, and their users aren't synced.
{% endhint %}

***

#### Connect Microsoft Dynamics 365 to Harmony

**Step 1: Navigate to Integrations**

1. Log into your Harmony dashboard
2. Navigate to **Settings** > **Integrations**
3. Find **Microsoft Dynamics 365** under **SaaS Applications** (or search for it by name)

**Step 2: Authorize with Microsoft**

1. **Initiate the connection**

   1. Click the **Microsoft Dynamics 365** card
   2. If a Microsoft Dynamics 365 instance is already connected, click **+ Create instance**
   3. Enter an **Instance name** (required)
   4. Click **Connect**

   You are taken to the Microsoft sign-in page.
2. **Sign in as a Global Administrator or Privileged Role Administrator**

   A non-admin account cannot complete this step, because the permissions Harmony requests need tenant-wide admin consent.
3. **Grant admin consent**

   1. Review the permissions Harmony is requesting (see [Permissions Explained](#permissions-explained) below)
   2. Check **Consent on behalf of your organization** if prompted
   3. Click **Accept**
   4. Microsoft returns you to Harmony

   Consenting adds the **Harmony Dynamics** enterprise application to your Microsoft Entra tenant. You will pick it as an application user in Step 4.

**Step 3: Enter your environment URLs**

Back in Harmony, the integration window asks for the remaining configuration.

1. In the **Power Platform admin center**, go to **Environments**, open each environment you want to sync, and copy its **Environment URL** (for example `https://contoso.crm.dynamics.com`)
2. Paste the URLs into **Dataverse environment URLs**, one per line or separated by commas
3. Click **Complete Configuration**

You can add or remove environments later by editing the instance's configuration. The connected Microsoft tenant stays the same.

**Step 4: Add Harmony as an application user in each environment**

Dataverse grants access per environment, so repeat this for every environment you listed in Step 3:

1. In the **Power Platform admin center**, go to **Environments** and open the environment
2. Go to **Settings** > **Users + permissions** > **Application users**
3. Click **+ New app user**, then **+ Add an app**, and pick **Harmony Dynamics**
4. Choose the environment's root **Business unit**
5. Under **Security roles**, add a role that can read users, security roles, business units, the organization, and audit history (see [Security role](#security-role) below)
6. Click **Create**

{% hint style="info" %}
Harmony skips an environment until its application user exists, then picks it up on the next sync. You can complete Step 3 first and add the application users afterwards.
{% endhint %}

**Step 5: Turn on auditing and Log access**

Activity comes from each environment's Dataverse audit log, which records access only when both auditing and **Log access** are on:

1. In the **Power Platform admin center**, open the environment
2. Go to **Settings** > **Audit and logs** > **Audit settings**
3. Turn on **Start Auditing** and **Log access**
4. Click **Save**

Dataverse records access from the time Log access is turned on. Earlier activity can't be recovered.

Once connected, Harmony syncs users and licenses every 6 hours. Activity syncs every 6 hours too, and the first sync reads up to 30 days of audit history.

{% hint style="info" %}
**Connecting more than one Microsoft tenant:** Microsoft Dynamics 365 supports up to two connected instances. If your Dynamics environments run in more than one Microsoft tenant, connect each tenant as its own instance. All environments within one tenant belong to a single instance - list them all in Step 3.
{% endhint %}

***

#### Disconnect Microsoft Dynamics 365 from Harmony

1. Log into your Harmony dashboard
2. Navigate to **Settings** > **Integrations**
3. Find **Microsoft Dynamics 365** under **SaaS Applications** and click its card
4. Click the delete (trash) icon next to the instance you want to remove
5. Confirm when prompted

Once disconnected, Harmony stops syncing data from Microsoft Dynamics 365. Previously synced data remains available in Harmony. To fully revoke access on the Microsoft side, remove the **Harmony Dynamics** application user from each environment, and remove the **Harmony Dynamics** enterprise application in the **Microsoft Entra admin center** > **Enterprise applications**.

***

#### What Harmony Syncs from Microsoft Dynamics 365

| Data                   | Description                                                                                                          |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------- |
| User profiles          | Name, email address, job title, account status (enabled or disabled), and creation date, per environment             |
| Dynamics license       | The Dynamics 365 licenses each user holds, resolved to a friendly name                                               |
| Security roles         | The security roles assigned to each user, and whether they are a System Administrator                                |
| Organizational details | Business unit, access mode (Read-Write, Administrative, Non-interactive, and others), and the Dataverse license type |
| Activity               | Last activity per user, from the environment's "User Access via Web" audit records                                   |

{% hint style="info" %}
**Where to find Microsoft Dynamics 365 data in Harmony:**

* **Applications** - Microsoft Dynamics 365 CRM appears as an application, with one instance per environment, each with its own users, licenses and activity
* **People** - Each employee's profile shows the environments they can access, their license plan, roles and activity
  {% endhint %}

**How license tiers are shown**

| Tier    | When                                                                                                                                                                                                      |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Paid    | The user holds a paid Dynamics 365 license                                                                                                                                                                |
| Free    | The user holds only a free Dynamics entitlement (the Customer Insights user license), or is in an access mode Microsoft doesn't bill for (Administrative, Support User, Non-interactive, Delegated Admin) |
| Unknown | A Read-Write user with no Dynamics 365 license. Such a user may be licensed another way, for example through a Power Apps plan                                                                            |

Licenses belong to the user, not to an environment, so a user with access to two environments shows the same license in both.

**What counts as activity**

Dataverse writes at most one access record per user per audit interval (four hours by default), so activity shows when a user last opened the environment, not every page they viewed.

* **Opening the environment in a browser or app** ("User Access via Web") counts as a login and updates the user's last activity
* **Access through the Web API** ("User Access via Web Services") is recorded as activity only. It does not update last activity, because integrations and scripts often run under a person's account and would make an unused seat look active

{% hint style="success" %}
**Harmony does not read your CRM data.** Harmony reads users, security roles, business units and access audit records only. Accounts, contacts, opportunities, cases and every other Dynamics record are never read.
{% endhint %}

{% hint style="info" %}
**Not included:**

* Application users (Harmony's own among them), and Dataverse's built-in system and support users. They aren't people holding a seat
* Security roles a user holds only through a team (for example an Entra group team). Such a System Administrator shows as a member
* License cost. Microsoft offers no price API, so cost comes from your contracts in Harmony
  {% endhint %}

***

#### Permissions Explained

**Microsoft Graph**

Harmony requests **application (app-only)** Microsoft Graph permissions, which is why a Global Administrator or Privileged Role Administrator must grant consent for the whole organization.

| Permission              | Type        | Purpose                                                                                                     |
| ----------------------- | ----------- | ----------------------------------------------------------------------------------------------------------- |
| `User.Read.All`         | Application | Read the Dynamics 365 licenses assigned to each user                                                        |
| `Organization.Read.All` | Application | Read the tenant's subscribed SKUs, to tell which licenses are Dynamics 365 licenses and resolve their names |

**Security role**

In Dataverse, Harmony's access is whatever security role you give its application user in each environment. Harmony only reads, so a custom read-only role is best. It needs organization-level **Read** on:

* **User**
* **Security Role**
* **Business Unit**
* **Organization**

and, for activity data, the **View Audit History** and **View Audit Summary** privileges.

{% hint style="info" %}
For a trial or evaluation environment, the built-in **System Administrator** role works too, but it grants far more than Harmony needs.
{% endhint %}

***

#### Use Cases

<details>

<summary>Reclaim Unused Dynamics Seats</summary>

Dynamics 365 licenses are among the most expensive per-user licenses in a Microsoft tenant. Harmony shows which paid seats haven't opened an environment recently, so you can remove the license or move the user to a cheaper one (Team Members, for example) before the next renewal.

</details>

<details>

<summary>Keep Production and Sandbox Apart</summary>

Because each environment is its own instance, you can see who has access to production and who only works in a sandbox, and review production access on its own.

</details>

<details>

<summary>Review Administrators</summary>

See every System Administrator and administrative-mode user per environment, and confirm that each one still needs that access.

</details>

<details>

<summary>Offboarding and Seat Recovery</summary>

Account status and licenses sync every 6 hours, so departing employees who still hold a Dynamics seat surface during offboarding rather than continuing to bill.

</details>

***

#### Troubleshooting

<details>

<summary>An environment shows no users</summary>

**Possible causes:**

* Harmony isn't an application user in that environment yet
* The application user has no security role, or its role can't read users
* The environment URL is wrong, or the environment was renamed or deleted
* The environment runs in a different Microsoft tenant than the one you connected

**Solutions:**

1. In the **Power Platform admin center**, open the environment, go to **Settings** > **Users + permissions** > **Application users**, and confirm **Harmony Dynamics** is listed with a security role (see [Step 4](#step-4-add-harmony-as-an-application-user-in-each-environment))
2. Copy the environment's **Environment URL** again and compare it with the URL on the instance. After a rename, replace the old URL with the new one
3. If the environment belongs to another Microsoft tenant, connect that tenant as a second instance
4. Wait for the next sync, up to 6 hours

</details>

<details>

<summary>Users sync but activity is empty</summary>

**Possible causes:**

* Auditing or **Log access** is off in the environment
* The application user's security role lacks the audit privileges
* Nobody has opened the environment since Log access was turned on

**Solutions:**

1. In the **Power Platform admin center**, open the environment, go to **Settings** > **Audit and logs** > **Audit settings**, and confirm both **Start Auditing** and **Log access** are on
2. Add the **View Audit History** and **View Audit Summary** privileges to the application user's security role
3. Activity appears on the next sync after users open the environment

</details>

<details>

<summary>Licenses show as unknown</summary>

**Possible causes:**

* Admin consent for the Microsoft Graph permissions was not granted, or was revoked
* The user is licensed through a Power Apps plan or another non-Dynamics license

**Solutions:**

1. In the **Microsoft Entra admin center**, go to **Enterprise applications**, find **Harmony Dynamics**, open **Permissions**, and confirm `User.Read.All` and `Organization.Read.All` are granted
2. If they are missing, reconnect the instance in Harmony to trigger the admin consent prompt again
3. In the **Microsoft 365 admin center**, check the user's licenses. If none is a Dynamics 365 license, unknown is expected

</details>

<details>

<summary>The connection fails during Microsoft sign-in</summary>

**Possible causes:**

* The account used is not a Global Administrator or Privileged Role Administrator
* Your tenant requires an admin consent request workflow
* Your tenant is a US Government or 21Vianet China cloud deployment

**Solutions:**

1. Retry with a Microsoft Entra Global Administrator or Privileged Role Administrator account
2. If your tenant uses an admin consent workflow, submit the consent request and connect again after it is approved
3. Confirm your tenant runs in the global Microsoft cloud

</details>

<details>

<summary>Harmony Dynamics isn't listed when adding the application user</summary>

**Possible causes:**

* Admin consent hasn't been granted yet, so the application doesn't exist in your Microsoft tenant

**Solutions:**

1. Complete [Step 2](#step-2-authorize-with-microsoft) first, then add the application user
2. In the app picker, search for **Harmony Dynamics** by name

</details>

***

#### Data & Privacy

<details>

<summary>Key privacy principles</summary>

For information about how Harmony handles your data, see our [Privacy Policy](https://harmony.io/privacy).

* Harmony accesses Microsoft Dynamics 365 in read-only mode and does not modify anything in your environments or your Microsoft tenant
* Harmony reads users, security roles, business units and access audit records only, never your CRM records
* Harmony reads only the environments you list on the instance, and only where you added Harmony as an application user
* Integration can be revoked at any time from Harmony settings, by removing the application user from an environment, or from the Microsoft Entra admin center under **Enterprise applications**

</details>


---

# 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://docs.harmony.io/integrations/saas-applications/microsoft-dynamics.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.
