Enable OAuth 2 authentication for Microsoft Dynamics 365
Please follow the steps below in order to enable OAuth 2 on your Microsoft Dynamics environment and connect the portal to the Dynamics instance:
Go to: https://admin.microsoft.com
Login with your Dynamics 365 credentials
On the left pane click on Show All
Under Admin Centers click in “Azure Active Directory”
In Azure portal click on the “Azure Active Directory” in the left pane
Under Manage click on App Registrations
Click on New registration on the toolbar
Enter “Magentrix D365 OAuth 2” for the application name
Select the second option:
Accounts in any organizational directory (Any Azure AD directory - Multitenant)
Under Redirect URI select “Web” and enter “http://localhost”
Click on the “Register” button
After saving your app, follow the steps below:
1) Set API Permissions
Under Manage click on “API permissions”
Click on “Add a permission” on the toolbar
Select “Dynamics CRM” on “Request API permissions” dialogue
Select the “Delegated permissions” box, (It gets highlighted in gray when selected).
Enable the user_impersonation checkbox
Click on the Add permissions button
2) Grant Admin Consent
Click on “Grant admin consent for <company name>” on the toolbar and click “Yes” on the confirmation dialogue box.
3) Update the Manifest
Under Manage click on Manifest
Set the allowPublicClient to true
Set the oauth2AllowIdTokenImplicitFlow to true
Set the oauth2AllowImplicitFlow to true
Click on Save button in the toolbar
4) Retrieve the Application ID:
5) Retrieve the API Endpoint:
6) Enter the details in the Magentrix Authorization screen.
The Authorization link will be provided to you by the Magentrix support team. Once you have completed the steps above, navigate to the link, select Dynamics CRM, select OAUTH, then enter the details in the form and click submit.
Enable Client Secret authentication + MFA for Microsoft Dynamics 365
1) Creating the secret key:
Go to Azure and select Azure Active Directory from the left pane
Under Manage click on App registrations
Select the Magentrix D365 OAuth 2 application you created before
Under Manage click on Certificates & secrets
Click on New client secret on the toolbar
Enter Magentrix D365 Secret in the Description
From Expires dropdown select 24 Months
Click the Add button
Your secret is added now. Copy the code under the Value column and keep it
Login to https://admin.microsoft.com/
Click on Show all
Click on All admin centers
Click on Dynamics 365 Apps
Click on Environments on the left pane if it is not already selected
Click on the environment that is being used in Magentrix (Hover over the link to see the URL)
Click on Settings on the toolbar
Expand Users + permissions
Click on Application users
Click on New app user on the toolbar
Click on Add an app
Select the Magentrix D365 OAuth 2 application
Select the correct Business unit from the dropdown
On the right side of security roles click on the pencil icon
Scroll down and select System Administrator and click on Save button
Click on Create button
2) Enter the details in the Magentrix Authorization screen:
The Authorization link will be provided to you by the Magentrix support team. Once you have completed the steps above, navigate to the link, select Dynamics CRM, select Multi-factor Authentication, then enter the details in the form and click submit.
See step 4 (Retrieve the Application ID) and step 5 (Retrieve the API Endpoint) in this article on how to retrieve the necessary information for the Client ID and API Endpoint fields.