# Microsoft Dynamics 365 Finance & Operations

Microsoft Dynamics 365 Finance & Operations (F\&O) is an enterprise ERP platform by Microsoft covering finance, procurement, supply chain, and manufacturing. Connecting it to Duvo lets your assignments query customers, vendors, legal entities, and other business data directly from your F\&O environment through its OData API.

## Setup

### Prerequisites

* A Microsoft Entra (Azure AD) app registration with the **Microsoft Dynamics ERP** API permission (listed as `Microsoft.ERP` in the Azure portal) and admin consent granted.
* A client secret generated for the app registration in the Azure portal under **Certificates & secrets**.
* The app registration must be mapped in your F\&O environment under **System administration > Setup > Microsoft Entra applications**, with the Client ID entered, a service account user assigned, and the State set to Enabled.
* The service account user in F\&O must have security roles that grant at least read access to the data entities your assignments need (for example, customers, vendors, and legal entities).

### Required Permissions

* The Azure AD app registration must have **API permissions** for the **Microsoft Dynamics ERP** API (`Microsoft.ERP`) with admin consent granted at the tenant level.
* The mapped F\&O application user must be assigned security roles that cover the data entities you plan to query. For read-only access to customers and vendors, a role such as **Accounts receivable clerk** and **Accounts payable clerk** (or a custom role with equivalent privileges) is sufficient.

### Connection Fields

| Field               | Description                                                                                                                                                                     |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Environment URL** | Your F\&O environment base URL (for example, `https://your-instance.operations.dynamics.com`). Find it in Lifecycle Services or your browser address bar when logged into F\&O. |
| **Tenant ID**       | Your Microsoft Entra tenant GUID. Find it in the Azure portal under **Microsoft Entra ID > Overview** or **App registrations**.                                                 |
| **Client ID**       | The Application (client) ID from the Azure AD app registration that has F\&O API permissions.                                                                                   |
| **Client Secret**   | A client secret generated for the app registration. Found under **Certificates & secrets** in the Azure portal.                                                                 |

### Optional Fields

| Field                    | Description                                                                                                                                                                       |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Legal Entity**         | A company code (dataAreaId) such as `USMF`. Scopes all queries to this company by default. If left blank and only one legal entity exists, Duvo selects it automatically.         |
| **Token URL (Advanced)** | Override for the Microsoft token endpoint. Defaults to `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token`. Only change this if your tenant uses a custom authority. |
| **Scope (Advanced)**     | Override for the OAuth scope. Defaults to `{environmentUrl}/.default`. Only change this if your environment requires a non-standard scope.                                        |

### Third-Party Documentation

* [Register an application in Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) — creating the app registration and generating client secrets.
* [Service endpoints overview (Finance & Operations)](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/services-home-page) — registering external applications and configuring Microsoft Entra applications in F\&O.
* [OData service endpoints (Finance & Operations)](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/odata) — available data entities and OData query capabilities.

## Capabilities

* **Query customers** — list, filter, sort, and paginate customer records from the CustomersV3 entity, including contact details, payment terms, and addresses.
* **Query vendors** — list, filter, sort, and paginate vendor records from the VendorsV2 entity with full supplier details.
* **Look up full partner details** — retrieve comprehensive information for a single customer or vendor by account number, returned as a formatted record with all available fields.
* **Search across business partners** — run a simultaneous search across both customers and vendors by name to quickly find matching records.
* **Discover legal entities** — list all legal entities (company codes) in your F\&O environment to identify the right data scope for other queries.
* **Run flexible OData queries** — execute custom OData queries against allowed data entities with filtering, field selection, sorting, and pagination for scenarios not covered by the built-in tools.

## Key Benefits

* **Direct ERP access** — assignments read from your F\&O environment in real time instead of relying on manual data exports or screen-by-screen navigation.
* **Cross-company querying** — query across all legal entities at once or scope to a single company, without switching sessions in F\&O.
* **Secure credential handling** — Azure AD client credentials are encrypted at rest and never exposed in logs or API responses.
* **Denormalized data** — F\&O data entities include related information (addresses, contacts, payment terms) as top-level fields, so assignments get complete records in a single query.
* **Finance-ready data** — pull customer credit limits, vendor records, and company information for reconciliation, reporting, and compliance workflows.

## Works Well With

* **Google Sheets or Microsoft Excel** — pull F\&O customer or vendor data into spreadsheets for financial analysis, reconciliation, or reporting.
* **Gmail or Microsoft Outlook** — retrieve business partner details and include them in automated notification or approval emails.
* **Slack or Microsoft Teams** — post alerts and status updates based on F\&O data to the relevant business channels.
