Search code examples
dynamics-crmmicrosoft-dynamicsdynamics-business-centralmicrosoft-dynamics-nav

Is AAD/OAuth the only way to authenticate with D365 APIs?


Dynamics 365 is clearly a huge topic and I know very little about it.

If I want to access a handful of web service end-points in D356 using an automated process, is there an alternative to AAD/OAuth for authentication? The examples that I've encountered so far haven't addressed automated/non-interactive D365 API access.

This question is similar to mine, however the accepted solution (Basic Auth/Web Service Access Key) is going away soon. It's also referring to a 'Connect App', and I'm thinking I'd rather hit an API directly.

Context: Currently, I have an automated one-way sync to an on-prem NAV DB that updates a handful of database tables directly when changes exist - it's not complicated. I need re-implement it once my IT department has migrated their NAV DB to MS Dynamics 360.

I understand that BC tables/objects can be exposed as web service end-points, and I anticipate having web-api access (OData) to the tables that I am currently updating directly.

However, authentication seems like it will be an issue. The D365 guidence seems to be OAuth (Authorization Code Grant), which doesn't immediately lend itself to automated processes given its interactive nature. Are there alternatives?


Solution

  • The short answer: OAuth through an Azure App Registrations is your only option for authentication with the Business Central API's.


    Depending on what tables it is you need to update, you will probably have to create an extension for Business Central that exposes the relevant tables through API pages. There is no shortcut for writing directly to the database.

    If you are already creating an extension you could also consider pulling the data from the source to Business Central. Then you could use the authentication method of your choosing (if you have full control of the source system).

    A work-around solution could be to import your data through RapidStart but it would not be very performant. It depends on the required update frequency.

    Last but not least: There are quite a lot of extensions available on AppSource which either provides integration to another system (e.g. D365 Sales) or allows you to do customized data import (e.g EDI).