Method #1: 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 “All admin centers”
- In main screen select “Microsoft Entra”
- In the left panelclick 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 Microsoft Entra ID tenant - Multitenant) - Under Redirect URI select “Web” and enter “http://localhost”
- Click on “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” tile on “Request API permissions” dialog
- 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 dialog box.
3) Update the Manifest
- Under Manage click on Manifest
- Set the isFallbackPublicClient to true
- Set the enableIdTokenIssuance to true
- Set the enableAccessTokenIssuance to true
- Click on Save button in the toolbar
4) Apply the settings to your Magentrix
- Click on Overview in the menu
- Copy the Application (client) ID by the clicking on the copy button

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.

1) Create secret key:
- 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 “All admin centers”
- Select “Microsoft Entra”
- In the left panel click on App registrations
- Select the Magentrix D365 OAuth 2 application you created before (if you don’t see the app, click on All Applications and search for it)
- 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. Copy the code under the Value column and keep it in a safe place
- Login to https://admin.microsoft.com/
- Click on Show all
- Click on Power Platform
- In the left panel click on Manage
- Click on Environments
- Click on the environment that is being used in Magentrix (Hover over the link to see the URL. It should match to your Dynamics 365 portal 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. (This is the first part of your Dynamics 365 portal URL. If you just type the first character, it will show in the suggestion list)
- Click the pencil icon for Security roles click
- 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.