I want to connect Azure Data Factory to my Business Central sandbox to export data. When I perform Test Connection I have a Authentication_InvalidCredentials error.
In Azure Data Factory I am created a new Linked Service. Previously I created a App Registration with a secret in Azure Entra. It has these Business Central permissions:
- AdminCenter.ReadWrite.All Application
- API.ReadWrite.All Application
- app_access Application
- Automation.ReadWrite.All Application
- Financials.ReadWrite.All Delegated
- user_impersonation Delegated
In Business Central Admin Center I created a Authorized Microsoft Entra App with admin consent. The is Application Id e38xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxc29f.
In my Sandbox environments I gave this Application user a few roles (not sure if this is needed):
- Business Central Dataverse Integration
- Power Platform Data Analytics Role
- Power Platform Dataflows Service Role
- System Administrator
I am using this JSON configuration, but I get the error below when I test the Linked Service connection:
{
"properties": {
"type": "OData",
"typeProperties": {
"url": "https://api.businesscentral.dynamics.com/v2.0/10f8xxxx-xxxx-xxxx-xxxx-xxxxxxxx2898/Sandbox/ODataV4/Company('Contoso')",
"authenticationType": "AadServicePrincipal",
"servicePrincipalId": "e38xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxc29f.",
"servicePrincipalKey": {
"type": "SecureString",
"value": "dNnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"tenant": "10f8xxxx-xxxx-xxxx-xxxx-xxxxxxxx2898",
"aadResourceId": "https://api.businesscentral.dynamics.com",
"endpoint": {
"allow": ["api.businesscentral.dynamics.com"]
}
}
}
}
The error:
Failed to create odata connection to RequestUrl.
Failed to get metadata of odata service, please check if service url and credential is correct and your application has permission to the resource. Expected status code: 200, actual status code: Unauthorized, response is : {"error":{"code":"Authentication_InvalidCredentials","message":"The server has rejected the client credentials. CorrelationId: 3ecfd2dc-81f5-408f-abb6-7270c1645585."}}.
What I am missing in my configuration? Is this even supposed to work?