# Integrating with Business Central

[Prerequisites](#prerequisites)

[Business Central Setup](#business-central-setup)\
&#x20;    [Step 1: Check whether you have a Tenant](#step-1-check-whether-you-have-a-tenant)\
&#x20;    [Step 2 (if necessary): Create a new Tenant](#step-2-if-necessary-create-a-new-tenant)\
&#x20;    [Step 3: Register your Azure Application](#step-3-register-your-azure-application)\
&#x20;    [Step 4: Add a Client Secret](#step-4-add-a-client-secret)\
&#x20;    [Step 5: Add Permissions](#step-5-add-permissions)\
&#x20;    [Step 6: Get Tenant ID and Environment Name](#step-6-get-tenant-id-and-environment-name)

[Drivetrain Setup](#drivetrain-setup)\
[Step 1: Add the Business Central Connector](#step-1-add-the-business-central-connector)

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

To connect Business Central to Drivetrain, you need:

1. An active Microsoft 365 Admin Account with access to Business Central and Azure
2. Admin privileges in Drivetrain

### Business Central Setup <a href="#business-central-setup" id="business-central-setup"></a>

#### Step 1: Check whether you have a Tenant <a href="#step-1-check-whether-you-have-a-tenant" id="step-1-check-whether-you-have-a-tenant"></a>

1. Sign in to your [Azure Portal](https://portal.azure.com/). if you do not have an Azure account, you can sign up for a free account [here](https://azure.microsoft.com/en-us/free/?WT.mc_id=A261C142F)
2. Once you sign in, locate the tenant name in the upper right-hand corner directly under your account name.

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FQIx7SG7u4OcE0hMKVDaG%2FBC-1.avif?alt=media&#x26;token=358f5f6c-74e7-4fe3-bbb4-d11d96786efe" alt=""><figcaption></figcaption></figure>

3. If you do not have a tenant, proceed to Step 2 to create a tenant else skip Step 2 and proceed to Step 3.

#### Step 2 (if necessary): Create a new tenant <a href="#step-2-if-necessary-create-a-new-tenant" id="step-2-if-necessary-create-a-new-tenant"></a>

1. Go to the [Azure Directory Creation Page](https://portal.azure.com/#create/Microsoft.AzureActiveDirectory) and log into your Active Directory account.
2. Choose the tenant type as **Azure Active Directory** then click on **Next: Configuration**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FXqiNnIc34sgGpPAM468K%2FBC-2.png?alt=media&#x26;token=15f0d16b-786b-4726-ba6a-fc91cd03532e" alt=""><figcaption></figcaption></figure>

3. Enter the required information for your tenant then select **Next: Review + Create**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FuCd0xbDi57U7FsTVU8Ti%2FBC-3.png?alt=media&#x26;token=219d1411-b305-4bcd-9fee-b1be922c35fb" alt=""><figcaption></figcaption></figure>

#### Step 3: Register your Azure Application <a href="#step-3-register-your-azure-application" id="step-3-register-your-azure-application"></a>

1. Search for App Registrations on Azure Home Page, and select App Registrations from the list

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2Fqu8GNi0EAmzx8ZJSkIZb%2FBC-4.avif?alt=media&#x26;token=38c45322-a504-44e9-ac40-4fb55fb05979" alt=""><figcaption></figcaption></figure>

2. Click on **+ New registration**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FcKsCO36PlE05mH24D4Rc%2FBC-5.avif?alt=media&#x26;token=53976911-1141-4508-b883-0c73b2c69d4e" alt=""><figcaption></figcaption></figure>

3. Enter the application name as “**Drivetrain Integration**” and select Multitenant option, please note it is important to select one of the **Multitenant** options to allow your users to link. Click on Register

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FbKPtnsXfdC87UNbB0eoq%2FBC-6.avif?alt=media&#x26;token=3df67c8c-deae-4ad5-99f9-0d544dfcd137" alt=""><figcaption></figcaption></figure>

4. On the application page, click on **Authentication** and click on **+ Add Platform**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FILiMvVuEpBPx3XGtiFDA%2FBC-7.avif?alt=media&#x26;token=2f606ad0-ea89-4dd7-9bca-234e7e875754" alt=""><figcaption></figcaption></figure>

5. Under Configure platforms, select Web and enter the following callback URI: <https://app.merge.dev/oauth/callback>

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FmlzUFyFsIq7WII3YuuMV%2FBC-8.avif?alt=media&#x26;token=949c35d6-1eb5-4952-9520-e8d042d8076f" alt=""><figcaption></figcaption></figure>

#### Step 4: Add a Client Secret <a href="#step-4-add-a-client-secret" id="step-4-add-a-client-secret"></a>

1. On the application page, click on **Certificates & Secrets** and then click on **+ New client secret**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2Fz93YcYoKdYgWEXcfNjmU%2FBC-9.avif?alt=media&#x26;token=62a42f54-3373-4cc4-b4ce-cee66d484ff2" alt=""><figcaption></figcaption></figure>

2. Add a description and select the maximum expiration date for your client secret, and click **Add**
3. Copy the Value and Secret ID in a secure document.

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FZEu0ITUSvSzToOCZLO9l%2FBC-10.avif?alt=media&#x26;token=71be86aa-f709-4ceb-8bae-223a9f454a17" alt=""><figcaption></figcaption></figure>

#### Step 5: Add Permissions <a href="#step-5-add-permissions" id="step-5-add-permissions"></a>

1. On the application page, click on **API permissions** and then click on **+ Add a permission**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2F0c7M5R1CkEnw2jdyeDhm%2FBC-11.avif?alt=media&#x26;token=edf4e179-2feb-44cd-9f0d-2cc783076c5c" alt=""><figcaption></figcaption></figure>

2. Select Dynamics 365 Business Central and click on **Delegated permissions** and select **Financials.ReadWrite.All**
3. Click on **Application permissions** and select all permissions and click **Add permissions**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FbCHGka34fx6cavwD6Caf%2FBC-12.avif?alt=media&#x26;token=2568c33f-7f09-4132-b9f2-fa6d0dfa9f09" alt=""><figcaption></figcaption></figure>

4. After adding all the permissions, status should be green. If you do not see green status for all permissions click on **Grant Admin Consent**

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2Fe1NYv7SePibIUVSiOlQJ%2FBC-13.avif?alt=media&#x26;token=d5897a70-c4f3-4d13-a200-3ba45a4551fd" alt=""><figcaption></figcaption></figure>

#### Step 6: Get Tenant ID and Environment Name <a href="#step-6-get-tenant-id-and-environment-name" id="step-6-get-tenant-id-and-environment-name"></a>

1. Log in to Microsoft Dynamics 365 Business Central.
2. Click on **Settings** and select **Admin center**
3. On the Admin center page, select the environment you want to integrate.

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2F7ntBMhX74WGcUtcUVH0O%2FBC-14.avif?alt=media&#x26;token=2b5d3ff8-a219-4cde-a002-7fb3de092931" alt=""><figcaption></figcaption></figure>

4. Copy the Tenant ID and Environment Name, you can find the Tenant ID in the URL of the environment. Store both of them in the same secured document.

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FKNxGzBzn5EIQqZLFuYjA%2FBC-15.avif?alt=media&#x26;token=018ff05f-8bab-44c7-a56c-b1cfcfadff7e" alt=""><figcaption></figcaption></figure>

### Drivetrain Setup <a href="#drivetrain-setup" id="drivetrain-setup"></a>

#### **Step 1**: Add the Business Central Connector <a href="#step-1-add-the-business-central-connector" id="step-1-add-the-business-central-connector"></a>

1. Once you login into Drivetrain, Click on + to add a new connector on Data page
2. Select Microsoft Dynamics 365 Business Central under Accounting & ERP Category
3. Enter the Tenant ID stored during Step 6 of Business Central setup and click on Next

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FpRYQcF1G62bN7VB4FLdi%2FBC-16.avif?alt=media&#x26;token=28116d7d-3811-4547-b100-ffcff3976106" alt=""><figcaption></figcaption></figure>

4. Enter the Environment name stored during Step 6 of Business Central setup and click on Next
5. Click on Open window, you will be redirected to Permissions page if you are already signed in else sign in to Business Central
6. Grant the permissions and you’ll be redirected to Drivetrain, click on Finish setup once the authentication is successful.
7. Your Business Central connection will start showing up on the Data page. Once the sync is complete, you will be able to see your Business Central data on Drivetrain!

<figure><img src="https://4220329029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmBZR0D9lq6jrI895OuOU%2Fuploads%2FZlgah1gFGXJgYIZQFK7J%2FBC-17.avif?alt=media&#x26;token=6e748065-0d9d-4f8d-a296-3ed562ff2887" alt=""><figcaption></figcaption></figure>
