How to Use an OData Connection with Service Principal Authentication for Dynamics 365 Business Central

As you may be aware, Web Service Access Key has now been deprecated for Dynamics 365 Business Central Online, and users will need to use OAuth instead. In this blog, I’ll show you how to use an OData connection with Service Principal Authentication for Dynamics 365 Business Central in Azure Data Factory, Azure Synapses Analytic, or Excel.

This will allow you to integrate Business Central with, for instance, a SQL server for 3rd-party reporting or a data warehouse.

Deprecation message for Web Service Access Key

Register an Application

First, you need to register an application with Azure AD and create a service principal:

Register an application. Go to Azure Portal. Select Azure Active Directory.

D365 ScreenshotSelect App registration:

Azure Active Directory sidebar menu with App registrations highlighted

Select New registration:

D365 Screenshot

Enter Name and select Supported account type. Click Register.

Azure window with Supported account type and Register buttons highlighted

You will need an Application (client) ID and Directory (tenant) ID.

Azure window with the Application (client) ID and Directory (tenant) ID

Create Client Secret

Select Certificate & secrets and click New client secret:

D365 BC Certificates and secrets window with New client secret highlighted

Enter Description and select Expires. Click Add. Please note that maximum expiry period is up to 24 months.

D365 BC Certificates and secrets page showing how to add a client secret

Copy Value and save it somewhere. It will only be visible once and you won’t be able to retrieve the value.

D365 BC certificates and secrets page showing where to find Value

Select API permissions:

Azure window with API permissions highlighted

Click Add a permission. Find Dynamics 365 Business Central and click it:

D365 BC request API permissions page with D365BC highlighted

Click Application permissions. Select API.ReadWrite.All and Automation.ReadWrite.All. Click Add permissions.

D365 BC API permissions page with applications permissions highlighted

Click Grant admin consent confirmation, then select Yes:

D365 BC API permissions page with Grant admin consent confirmation highlighted

Set up the Azure AD Application in Business Central

Go to Dynamics 365 Business Central. Search for Azure Active Directory Applications and open the page.

D365 BC window with Azure Active Directory Applications highlighted

Click New.

D365 BC window with New button highlighted

Copy Application (client) ID from App and paste it on Client ID. Enter Description. Assign permissions.

D365 BC window with Client ID and Description highlighted Azure window showing D365 BC Application ID

Create OData Dataset

Next, create an OData dataset for Dynamics 365 Business Central in Azure Data Factory.

Create dataset. Open Azure Data Factory Studio. Click New dataset.

Azure Data Factory window highlighting Datasets and New dataset dropdown

Search OData. Click OData, then Continue.

Window showing new datasets Azure Data Factory window highlighting new OData dataset

Enter Name, click new for Linked service.

Azure Data Factory highlighting Name and New fields

Then, enter this information:

Click Create.

OData window showing New linked service with create button highlighted

Click OK.

Set properties window with OK button highlighted

Click Parameters tab. Create a new parameter.

Azure Data Factory window with Parameters tab highlighted

Click the Connection tab. Select Edit and add the parameter as dynamic content.

Azure Data Factory window with Connection and Edit buttons highlighted

Enter value for the parameter and click OK. Your Company/name of entity. Company(‘CRONUS%20Canada%2C%20Inc.’)/ItemCard

Azure Data Factory window highlighting Value entry and OK button Azure Data Factory window showing Preview data

If you need assistance with OAuth, data warehousing, reporting, or integrations with Dynamics 365, please get in touch with us, we’d love to help.

Are You Receiving Our Newsletters?

Subscribe to receive our monthly newsletters with the latest updates all in one place! Get important product information, event recaps, blog articles, and more.


Monthly Newsletter Straight to Your Inbox