web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Active Discussion

How to enable OAuth authentication in Dynamics 365 Integration for Dynamics NAV and Dynamics 365 Business Central

(2) ShareShare
ReportReport
Posted on by Microsoft Employee

UPDATED 17th November 2021 

UPDATED 3rd February 2022

NOTE: PLEASE USE A TEST ENVIRONMENT FIRST AND TAKE NOTE OF THE STEPS.

This is just a more articulated step by step description of what is reported in the official documentation Integrating with Dynamics 365 Sales - Business Central | Microsoft Docs considering an environment that is already working successfully with O365 legacy authentication (but it might also be applied to new deployments).

 

It applies to the following versions and minimum CUs:

Version

Minimum Cumulative Update

Dynamics 365 Business Central 15.x 

December 2020  CU (15.13)

Dynamics 365 Business Central 14.x 

January 2021 CU 20 (14.21)

Dynamics NAV 2018

June 2021 CU 41

Dynamics NAV 2017

July 2021 CU 55

Dynamics NAV 2016

July 2021 CU 67

IMPORTANT: BOTH application (objects) and platform need to be updated *** (see bottom of this blog)

IMPORTANT: If you have a different major version or a lower CU than the one highlighted stop reading. What will follow will not work for you.

IMPORTANT: With Dynamics NAV 2016, read Modifying Dynamics 365 Sales Code for Technical Upgrade to Dynamics NAV 2016 | Microsoft Docs

 

PRE-REQUISITES

Be sure to have deployed CRM Solution ZIP file from the DVD in Dynamics 365

 pastedimage1624610678157v1.png

 1) Create an integration user in Microsoft 365 Admin Center 

  1. Login to Microsoft 365 Admin Center as Global Administrator
  2. Go to Users > Active Users > Add a User
  3. Name the user like e.g. D365INTEGRATION and assign a strong password
  4. IMPORTANT: Assign the user a valid license for D365

 2) Add the integration user to Dynamics 365 through Power Platform Admin Center

  1. Go to Power Platform Admin Center and choose the Dynamics 365 environment
  2. On the right side, click on User > See All
  3. Click on Add user
  4. On the right pane, type e.g. D365INTEGRATION (your integration user) and assign these 2 roles:
    • Dynamics NAV Integration Administrator
    • Dynamics NAV Integration User

                         Click Save (below how it should look like)

pastedimage1624610787095v2.png

VERY IMPORTANT

 

3) Change integration user to be non-interactive in Dynamics 365

  1. Go to Dynamics 365 Advanced settings
  2. Select Settings > Security > Users and select D365INTEGRATION user
  3. Scroll down in the Administration tab and change Access Mode to Non-Interactive

pastedimage1624610875306v3.png 

 

4) Create an App Registration in Azure

  1. Login to Azure portal with Global Administrator credentials
  2. Go to App Registration and click New registration
  3. Type a name like e.g. OAuth D365 Integration
  4. Choose Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)
  5. Click Register pastedimage1624610991903v5.png
  6. IMPORTANT: When the application is registered, in the Overview tab, take note of the Application ID: this will be used in the OAuth connection string later on.

pastedimage1624611111682v6.png

5) Assign API permissions to the registered App

  1. Go to API Permission tab and click add a permission
  2. Select Dynamics CRM
  3. Select user_impersonation and click Add Permissions

 pastedimage1624611146747v7.png

 

6) Change app registration manifest to public

  1. Go to Manifest tab
  2. Modify this property as "allowPublicClient": true,
  3. IMPORTANT: click SAVE on top left of the manifest (or changes will not be saved)

7) Add consent to App Registration from Global Administrator

  1. In the azure portal search for Enterprise applications
  2. Select your app registration (e.g. OAuth D365 Integration) and go to Permissions
  3. Click Grant admin consent for <TenantName>
  4. In the end, you should have Dataverse API granted through Admin consent and Granted by An Administrator (see image below)

 pastedimage1624611239763v8.png

8) Configure Dynamics NAV / 365 Business Central to connect using OAuth

  1. In Dynamics NAV / 365 Business Central, go to Microsoft Dynamics 365 For Sales Connection Setup page and add user id (e.g. D365INTEGRATION@domain.onmicrosoft.com) and password
  2. Change the connection string field with the one provided below.

IMPORTANT: Change the following parameters accordingly to your own

Username : Your username (e.g. d365integration@yourdomain.onmicrosoft.com)

Url : your Dynamics 365 Url (e.g. https://yourorganization.crm4.dynamics.com)

AppId : App registration application ID taken from the overview tab

RedirectUri : app://<AppId>

 

Dynamics NAV 2016, 2017 and 2018 :

AuthType=OAuth;Username=D365INTEGRATION@dtbcde21060.onmicrosoft.com;Password={PASSWORD};Url=https://dtbcde21060.crm4.dynamics.com;AppId=c3ee8b64-d711-4a51-8a99-ae31de68c30a;RedirectUri=app://c3ee8b64-d711-4a51-8a99-ae31de68c30a;TokenCacheStorePath=;LoginPrompt=Never                           

Dynamics 365 Business Central 14.x and 15.x:

IMPORTANT: you MUST choose Dynamics 365 SDK version 91 in the configuration page 

AuthType=OAuth;Username=D365INTEGRATION@dtbcde2106.onmicrosoft.com;Password={PASSWORD};Url=https://dtbcde21060.crm4.dynamics.com;AppId=c3ee8b64-d711-4a51-8a99-ae31de68c30a;RedirectUri=app://c3ee8b64-d711-4a51-8a99-ae31de68c30a;ProxyVersion=91;TokenCacheStorePath=;LoginPrompt=Never

 

9) Test connection. It should be successful.

If you like, you could now remove the license in Microsoft 365 Admin Center for the Dynamics 365 integration user (this should not be needed for non-interactive users). IMPORTANT: leave this task as last one and only at the end of the configuration and when everything is setup and proof to be fully working.

*** (note related to application merge)

Microsoft position about deployment of updates is always to perform a full update of both platform and application (and not only platform side). This is proof to work and what has been fully tested by Microsoft. 

Within this specific case, where OAuth (through ADAL libraries) has been introduced to handle the connection, API handling for authentication might have been changed, it is feasible that you also have to merge the application.

Considering the more exotic customization or extensions in place that partner might have thought of, the following generic approach could be considered.

1. Be sure to get used to OAuth integration by deploying a Cronus database and a sandbox Dynamics 365 environment and have them fully working. This will proof that you could master OAuth integration related to your own upgrade.

2. Test initially a platform (so called, technical) upgrade to the version that implement OAuth for Dynamics 365 integration.

If you succeed in having this connected with just the platform and (very important) you widely, carefully and fully test all the standard and non standard integration, then you might think of moving the application in a second time or, more preferrable, to plan a full upgrade to latest version, as soon as possible.

3. If tests are failing, merge all the objects related to Dynamics 365 integration (typically the ones that have ‘CRM’ in their name) and also the objects related to Job Queue and Task Scheduler (these are very important too, these have ‘job queue’ in their name, typically).

If you succeed in having this connected and (very important) you widely, carefully and fully test all the standard and non standard integration, then you might think of fully moving the application in a second time or, more preferrable, to plan a full upgrade to latest version, as soon as possible.

4. If tests are failing, then review the merge process and perform a fully merge of the objects as per Microsoft recommendation and support.

  • CollinsGayle Profile Picture
    5 on at
  • MarcIbanez Profile Picture
    32 on at

    Hello,

    this steps work perfectly for Dynamics NAV 2017.

    But, if in Azure Directory, active the WAF whit Prevention mode, the integration fails whit message "403 - Forbidden: Access is denied.".

    "ERROR REQUESTING Token FROM THE Authentication context - General ADAL Error
    Federated service at DOMAINNAME.com/.../usernamemixed returned error: =>
    Response status code does not indicate success: 403 (Forbidden)."

    ¿What we can do for solve this problem?

    Thanks in advance,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,829 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,057 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 613 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans