Setup Postman to connect to Dynamics 365 CRM using OAuth 2.0 | Azure App Registration

If you want to test the WEB API in Dynamics 365 CRM using Postman, here’s what you need to do to setup Postman to connect to Dynamics 365’s Web API

There are 2 parts to this setup –

  1. Registering an App in Active Directory.
  2. Configuring Postman to utilize the App to connect to Dynamics 365.

So, let’s look at how we do this!

Register an App in Azure

The first step is to register an App in your Azure’s Active Directory so that you can use it to test using your Postman on your machine –

  1. Go to the Azure Portal (https://portal.azure.com/) and the look for or search for Azure Active Directory

  2. In AAD, look for App Registrations.

  3. Now, register a new App in the App Registration

  4. Enter the details of the App Registration so you can identify what the App is for. Since I’m using this for Postman testing, I’ll enter something like – “Postman WEB API
    Also, since in most cases your Azure environment could be different, it’s recommended to select Accounts in any organizational directory (Multitenant), but it’s up to you based on how you can to secure this!
    Since, I’m testing on my local machine using Postman, I’ll enter http://localhost

    And finally click on Register.

  5. Once this is registered, you’ll see the details like any other Azure resource and look for Client ID and copy the same and save it somewhere temporarily.

  6. Next is updating the Manifest to support this setup.
    Set the “allowPublicClient” flag to true and “oauth2AllowImplicitFlow” to true as well.

  7. Once the Manifest is updated, it should look like this –

  8. Final step is to give permissions for Dynamics 365 to this App we just created. Go to API Permissions tab from the left-hand menu and click on + Add a permission button.

  9. Look for the Dynamics CRM option and select it.

  10. Select it and then click on Add permissions.

  11. Once added, you’ll need to Grant Permissions. At this moment when it’s not granted, the Status can be seen as blank.

  12. Select Yes to Grant Permissions.

  13. Once granted, the Status will be updated as follows – the status of Granted for [OrgName] will appear

  14. And we are done setting up the App in Azure Portal to be utilized by Postman to test Dynamics 365 Web API locally.

Setting up Postman

Now that we have the App setup, open Postman and we’ll utilize the above created App to establish a connection with Dynamics 365 CRM using OAuth2.0 –

  1. In your Dynamics 365 CRM environment, capture the OAuth URL in your Customization > Developer Resources section

  2. Enter this in a new Tab in your Postman and if you directly try to test this, you’ll get 401 Unauthorized.

  3. Now, we’ll have to configure the Authorization tab to be able to authenticate into Dynamics 365 CRM using the App registration we created in Azure in steps above.

  4. Now, enter the details we have captured so far –
    Token Name – Enter a suitable Token name
    Grant Type – Select Implicit if not already set.
    Callback URL – The callback URI should be http://localhost based on what we set in Azure in above steps.
    Auth URL – Here’s how you can get the Auth URL for your Dynamics 365 environment -> OAuth 2.0 URL for Dynamics 365
    Client ID – This should be what you saved above from the Azure App Service. Refer to step #5 in the Setting up App in Azure section above in this post. This should be the Application ID.

    Once all this is entered, click on Get New Access Token

  5. Once you click on Get New Access Token, you’ll need to authenticate into the environment as you usually get while connecting from Browser.
    Enter credentials and authenticate.

  6. Once this connection and the permissions are correctly validated, you’ll get a message like this –

  7. And it’ll show you this dialog box where you need to simply click on the Use Token button.

  8. You’ll then see the token as below –

  9. And you’re set!! Now, you can simply test using Postman.

Testing using Postman

Now that you are authenticated, you can click on Send and see that you are now able to retrieve the Web API

Hope this was helpful! Here are some more Dynamics 365 posts which you might be interested in –

  1. Dynamics 365 Storage Utilization | Dataverse Storage | Power Platform Admin Center
  2. Use Hierarchy in Roll Up Fields in Dynamics 365 CRM
  3. Filter records in a View owned by a Team you are a member of | Dynamics 365 CRM
  4. Get GUID of the current View in Dynamics 365 CRM JS from ribbon button | Ribbon Workbench
  5. Dynamics 365 App For Outlook missing on SiteMap in CRM? Use shortcut link [Quick Tip]
  6. Import lookup referencing records together in Dynamics 365 CRM | [Linking related entity data during Excel Import]
  7. Mailbox Alerts Hide/Show behavior in Dynamics 365 CRM
  8. Excel Importing Notes (Annotation) entity in Dynamics 365 CRM
  9. Enable/Disable the need to Approve Email for Mailboxes in Dynamics 365 CRM CE
  10. Call Azure Function from Dynamics 365 CRM using Webhooks
  11. Show Ribbon button only on record selection in Dynamics CRM
  12. Accessing multiple occurrences of a field in Business Process Flow using JS in D365 CRM

Thank you!!

2 thoughts on “Setup Postman to connect to Dynamics 365 CRM using OAuth 2.0 | Azure App Registration

    • I believe you’ll need to save all the details beforehand. Once it’s star marked, you won’t be able to see it. Not sure if that’s what you meant to ask or in case am I missing something.

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.