Enabling OAuth 2 authentication for Microsoft Dynamics 365


    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

    1. Login with your Dynamics 365 credentials

    2. On the left pane click on Show All

    3. Under Admin Centers click in “Azure Active Directory”

    4. In Azure portal click on the “Azure Active Directory” in the left pane

    5. Under Manage click on App Registrations

    6. Click on New registration on the toolbar

    7.  Enter “Magentrix D365 OAuth 2” for the application name

    8.  Select the second option:
      Accounts in any organizational directory (Any Azure AD directory - Multitenant)

    9. Under Redirect URI select “Web” and enter “http://localhost”

    10. Click on the “Register” button  



    After saving your app, follow the steps below:

    1) Set API Permissions

    1. Under Manage click on “API permissions”

    2. Click on “Add a permission” on the toolbar

    3. Select “Dynamics CRM” on “Request API permissions” dialogue

    4. Select the “Delegated permissions” box, (It gets highlighted in gray when selected).

    5. Enable the user_impersonation checkbox

    6. 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

    1. Under Manage click on Manifest

    2. Set the allowPublicClient to true

    3. Set the oauth2AllowIdTokenImplicitFlow to true

    4. Set the oauth2AllowImplicitFlow to true

    5. 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 clicking on the copy button


    • Login to your Magentrix portal with an Admin account

    • Go to: Setup > Extend > Connected Apps

    • Select DynamicsCrm from the list and click on Edit button

    • Enter the Application (client) ID in the “Security Token” field

    • Click on Save button



    Enable Client Secret authentication + MFA for Microsoft Dynamics 365

    1) Creating the secret key:


    1. Go to Azure and select Azure Active Directory from the left pane

    2. Under Manage click on App registrations

    3. Select the Magentrix D365 OAuth 2 application you created before

    4. Under Manage click on Certificates & secrets

    5. Click on New client secret on the toolbar

    6. Enter Magentrix D365 Secret in the Description

    7. From Expires dropdown select 24 Months

    8. Click the Add button

    9. Your secret is added now. Copy the code under the Value column and keep it

    10. Login to https://admin.microsoft.com/

    11. Click on Show all

    12. Click on All admin centers

    13. Click on Dynamics 365 Apps

    14. Click on Environments on the left pane if it is not already selected

    15. Click on the environment that is being used in Magentrix (Hover over the link to see the URL)

    16. Click on Settings on the toolbar

    17. Expand Users + permissions

    18. Click on Application users

    19. Click on New app user on the toolbar

    20. Click on Add an app

    21. Select the Magentrix D365 OAuth 2 application

    22. Select the correct Business unit from the dropdown

    23. On the right side of security roles click on the pencil icon

    24. Scroll down and select System Administrator and click on Save button

    25. Click on Create button


    2) Entering the secret key in Magentrix


    1. Enter NA for Consumer Key

    2. Enter the Client Secret (from step 9 above) into the Consumer Secret field

    3. Enter the AppID into the Refresh Token field

    4. Click on Save button



    « Previous ArticleNext Article »

     5.0 (1)


    No records to display

    Follow Knowledge posts
    Please enter your email address to subscribe:

    Follow us on Twitter