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