Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Online Authentication with Client Credentials

Community Member Profile Picture Community Member Microsoft Employee

Introduction:

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

Steps:

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

POST URL:

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

Header:Content-Type: application/json

Body:

Key Value
client_id Application 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.

The post Dynamics 365 Online Authentication with Client Credentials appeared first on .

Comments

*This post is locked for comments