Dynamics 365 Online Authentication with Client Credentials | CloudFronts

Dynamics 365 Online Authentication with Client Credentials


This blog explains how to Authenticate Dynamics 365 Online with Client Credentials.


Steps in Azure

1. Register a App in Azure Active Directory.

  • Login to portal.azure.com
  • Navigate to Azure Active Directory –> App Registration –> New Application registration

2.  Create App with Application type -> Web app/ API.

Copy the Value of Application ID.

3. Give permission to Dynamics 365 Online.

  • Go to Settings –> Required permissions –> Add –> Dynamics CRM Online –> Select 
  • Select the following permission.

4. Click on Grant Permissions –> Yes

5. Generating client secret key.

  • Go to Settings –> Keys
  • Create a new key and copy its value

Steps in D365 Sales

Create Application user.

1. Add a user from Portal.office.com

2. Go to settings -> security -> users.

  • Change the view to Application Users.
  • Add New user.

3. Enter User name and Application ID.

  • Value of Application ID is obtained from MS Azure.

4. save

5. After Saving values of Application ID and Azure AD Object ID will come automatically.

Steps in Azure

1. Add this user as Owner of the App which we created in MS Azure.

  • Settings –> Owners –> Add owner

2. Obtain tenant id

Azure Active Directory –> Properties –> Directory ID


Making a Request using Postman


https://login.microsoftonline.com/<tenant id> /oauth2/token

Header:Content-Type: application/json


Key Value
client_idApplication ID of the registered app in Azure
resource https://trial.crm.dynamics.com (Dynamics 365 Online Insance URL
Client_secret Key value from the registered app in Azure
Grant_type client_credentials

Below screen shows how to use above given keys to generate the access token. This token has expiration time. You need to refresh this token.

Share Story :

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.