Data connection to Microsoft Business Central

Has anyone successfully connected to Microsoft Business Central using the the built in Microsoft Dynamics 365 Business Central connector?

I have custom APIs exposed in Business Central. I’ve followed the documentation thoroughly - registered my palantir app, etc. It connects to BC but then errors out without a token…

Here is the documentation I’m referencing. The part I don’t know how to do: “Call stored procedures to complete the OAuth exchange” and then how to set up the automatic refresh.
https://cdn.cdata.com/help/FBJ/jdbc/pg_connectionj.htm#:~:text=Call%20stored%20procedures%20to%20complete%20the%20OAuth%20exchange

In short:
InitiateOAuth has to be set to REFRESH but then the documentation says you need to call some commands to record the auth token and do a few more steps that I don’t know how to do…. If you set InitiateOAuth to OFF it fails without the token. And if you set it to GETANDREFRESH it errors saying it can’t open a browser and you need to use a headless configuration, which I also don’t understand how to set up.

Can anyone provide guidance? Or is there a better way to connect to custom APIs in Business Central?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

Configuring a direct connection from Foundry to Business Central occurs in 3 different places: Azure, on your Business Central application, and in the Foundry Data Connection Application. This process uses the built in Microsoft 365 Dynamics Business Central connector in the Data Connection app.

I. Configuration in Azure:

  1. Log in to azure portal

  2. Go to app registrations → + new registration

  3. Give name, single tenant, (optional redirect URL)

  4. On the app page, in the left hand side bar, select “Manage” → “API permissions”

1. Under configured permissions select add a permission

  1. Select Dynamics 365 Business Central
  2. Select Application Permissions
  3. Select the permissions you would like to enable here

    1. app_access
    2. AdminCenter.ReadWrite.All
    3. API.ReadWrite.All
    4. Automation.ReadWrite.All

2. Under configured permissions select “Grant Admin Consent for <Company Enrollment Name>”

  1. The status column in the table below should go from orange warning signs to green check marks “Granted for <Company Enrollment Name>”
  1. On the app page still, in the left hand side bar, select “Manage” → “Certificates & Secrets”
1. Configure a new client secret. The value of the secret will only be shown once, and this is your OAuthClientSecret. Retain this value for your configuration in Foundry (or setup a new client secret here when you do your connection configuration in Foundry). The “Value” not the “Secret ID” is what goes in your Foundry JDBC “**OAuthClientSecret**” Property.
  1. On this same app page, in the the left hand side bar select “Overview”. From this page retain the following values for your configuration on your Business Central Application and in the Foundry Data Connection Application:
1. Directory (tenant) ID *note that this is your “**AzureTenant**”
2. Application (client) ID *note that this is your “**OAuthClientID**”

II. Configuration on Business Central:

Configure Permissions

Go to the main page for your business central application. Use the search bar to look for “Microsoft Entra Applications”. Open the pop out window.

Press “+ New” to create a new app for configuration. Use the Application (client) ID you obtained above, and paste it in the Client ID field in between the curly brackets. Enter a description and et the state to “Enabled”.

Under “User Permission Sets” click into the table and add Permission Set: “D365 BUS FULL ACCESS”.

Authorize Application

In your Business Central application, click on the cog wheel on the upper right corner. Select Admin Center.

  1. Select “Environments” in the left hand side bar

  2. If there are no environments yet,

1. Click “+ New” at the top, fill out the pop up window
2. Give an environment name and select a type (either “Production” or “Sandbox”)

  1. Retain the value saved for “**Environment Name**”. This will be needed in the Foundry connector configuration step.
  1. If there is already an environment created,
1. Retain the “**Environment Name**” value. This will be needed in the Foundry connector configuration step.
  1. In the left hand side bar, select “Microsoft Entra Apps”

  2. Click “+ Authorize Microsoft Entra app” at the top

  3. Give the Application (client) ID obtained above and save.

III. Configuration in Foundry:

Use the Microsoft 365 Dynamics Business Central Connector.

Connection Details:

JDBC Properties: This connection requires the following 5 JDBC Properties

OrganizationURL
AuthScheme
AzureTenant
OAuthClientID
OAuthClientSecret (encrypted property)

  • For the Organization URL: https://api.businesscentral.dynamics.com/v1.0/ODataV4/
  • The AuthScheme is “AzureServicePrincipal”
  • The AzureTenant, OAuthClientID, and OAuthClientSecret are all values obtained above.
    • If you have lost the value associated with the OAuthClientSecret, repeat the step to create it and use the new value.

Network Connectivity:

Add policies:
api.businesscentral.dynamics.com (port 443)
login.microsoftonline.com (port 443)