# Dynamics 365 Business Central

Dynamics 365 Business Central is a cloud ERP system by Microsoft for small and mid-sized businesses, covering finance, sales, purchasing, and inventory. Connecting it to Duvo lets your assignments access financial records, customer and vendor data, and operational information directly from your Business Central environment.

## Setup

### Prerequisites

* A Microsoft Entra ID (formerly Azure AD) app registration with the **Dynamics 365 Business Central** API permission (`API.ReadWrite.All`) and admin consent granted.
* Access to the Azure portal to retrieve the Tenant ID, Client ID, and generate a Client Secret for the app registration.
* The app registration must be added in Business Central under **Microsoft Entra applications** with **State** set to **Enabled** and the appropriate **User Permission Sets** assigned (for example, `D365 READ` for read-only access or `D365 BUS FULL ACCESS` for broader operations).
* A Business Central environment (production or sandbox) that the app registration can access.

### Required Permissions

* The Entra ID app registration must have the **Dynamics 365 Business Central** API permission `API.ReadWrite.All` with admin consent granted.
* Inside Business Central, the app must be registered under **Microsoft Entra applications** with appropriate permission sets assigned. The permission sets control which data the app can access (customers, vendors, companies).

### Connection Fields

| Field             | Description                                                                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Tenant ID**     | Your Microsoft Entra ID (Azure AD) tenant GUID. Find it in the Azure portal under **Microsoft Entra ID > Overview** or **App registrations**. |
| **Client ID**     | The Application (client) ID from your Entra ID app registration that has Business Central API permissions.                                    |
| **Client Secret** | A client secret generated for the app registration. Found under **Certificates & secrets** in the Azure portal.                               |

### Optional Fields

| Field           | Description                                                                                                        |
| --------------- | ------------------------------------------------------------------------------------------------------------------ |
| **Environment** | The Business Central environment name to connect to. Defaults to `production` if left blank.                       |
| **Company ID**  | The GUID of the specific Business Central company to use. Leave blank to auto-select when only one company exists. |

### Third-Party Documentation

* [Register an application in Microsoft Entra ID](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-develop-connect-apps#register-your-application-in-azure-ad) — creating the app registration and granting Business Central API permissions.
* [Set up Microsoft Entra applications in Business Central](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/automation-apis-using-s2s-authentication#task-2-set-up-the-microsoft-entra-application-in-) — registering the app inside Business Central and assigning permission sets.
* [Business Central API overview](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/) — available API endpoints and entity reference.
* [Entra ID app registration quickstart](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) — general guide to registering apps and generating client secrets.

## Capabilities

* **Query customers and vendors** — retrieve contact details, payment terms, balances, and aging data for customers and vendors, with filtering, sorting, and pagination.
* **Look up full partner details** — get comprehensive information for a specific customer or vendor, including financial details, aging buckets, dimensions, and contact persons.
* **Search across business partners** — run cross-entity searches across both customers and vendors to find the right records quickly.
* **Discover companies** — list all companies available in your Business Central environment to identify the right data scope.

## Key Benefits

* **Direct ERP access** — assignments read from Business Central in real time instead of relying on manual data exports or screen-by-screen navigation.
* **Secure credential handling** — Azure AD client credentials are encrypted at rest and never exposed in logs or API responses.
* **Flexible scoping** — target a specific environment and company, or let the connection auto-select when your tenant has a single company.
* **Finance-ready data** — pull customer balances, vendor records, and company information for reconciliation, reporting, and compliance workflows.

## Works Well With

* **Google Sheets or Microsoft Excel** — pull Business Central customer or vendor data into spreadsheets for financial analysis, reconciliation, or reporting.
* **Gmail or Microsoft Outlook** — pull customer or vendor details and include them in automated notification or follow-up emails.
* **Slack or Microsoft Teams** — post payment alerts, vendor updates, or financial summaries to the relevant business channels.
