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.
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.
Select App registration:
Select New registration:
Enter Name and select Supported account type. Click Register.
You will need an Application (client) ID and Directory (tenant) ID.
Create Client Secret
Select Certificate & secrets and click New client secret:
Enter Description and select Expires. Click Add. Please note that maximum expiry period is up to 24 months.
Copy Value and save it somewhere. It will only be visible once and you won’t be able to retrieve the value.
Select API permissions:
Click Add a permission. Find Dynamics 365 Business Central and click it:
Click Application permissions. Select API.ReadWrite.All and Automation.ReadWrite.All. Click Add permissions.
Click Grant admin consent confirmation, then select Yes:
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.
Copy Application (client) ID from App and paste it on Client ID. Enter Description. Assign permissions.
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.
Search OData. Click OData, then Continue.
Enter Name, click new for Linked service.
Then, enter this information:
- Service URL https://api.businesscentral.dynamics.com/v2.0/Your Directory (tenant) ID/Production/ODataV4/
- AAD Source https://api.businesscentral.dynamics.com/
- Tenant – Directory (tenant) ID from registered App
- Service principal ID – Application (client) ID from registered App
- Service principal key – Value from registered App
Click Parameters tab. Create a new parameter.
Click the Connection tab. Select Edit and add the parameter as dynamic content.
Enter value for the parameter and click OK. Your Company/name of entity. Company(‘CRONUS%20Canada%2C%20Inc.’)/ItemCard
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.
Manage Multiple Companies Effortlessly in Dynamics 365 Business Central
Discover the advantages of managing multiple companies within a single Business Central instance.
12:00 pm – 1:00 pm PST
Webinar - Manage Multiple Companies - D365 BC
12:00 pm – 1:00 pm PST