I have set up a linked service in Azure Data Factory using a service principle. The connection is all good, but the problem arises when trying to get data from any entity in Business Central. I get the following error message:
The context URL 'https://api.businesscentral.dynamics.com/v2.0/{Tenant ID}/Sandkassen/ODataV4/$metadata#Company('CRONUS%20Danmark%20A%2FS')/Items' is invalid.
{Tenant ID} is the correct tenant ID.
If I just send the following request: 'https://api.businesscentral.dynamics.com/v2.0/{Tenant ID}/Sandkassen/ODataV4/$metadata#Company('CRONUS%20Danmark%20A%2FS') I get an answer: enter image description here So I am doing something wrong when trying to reach any entity.
I tried various entities. I tried deleting the Linked Service and starting all over again, but still the same error appeared.
I tried using the same Odata URL in Power Query without any issues. However, my current use case does not involve using Power BI, so this is not an option.
Has anyone faced the same issue and resolved it?
I found the answer to my own question. I dont know why, but I have to state the company ID, and not the company name, if I want to access BC tables. So the URL will be:
'https://api.businesscentral.dynamics.com/v2.0/{Tenant ID}/Sandkassen/ODataV4/$metadata#Company('Company ID')/Items
Company ID can be found using only the company name in the URL, and not specifying a table.
Link to microsoft documentation: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-develop-connect-apps