Search code examples
azuredynamics-crmazure-active-directorydynamics-crm-webapi

Error in accessing CRM instance using REST API from a Windows Desktop Application


I am getting following error while trying to retrieve data from CRM instance using REST API from my Windows Desktop Application.

AADSTS65001: The user or administrator has not consented to use the application with ID '4cdb6f7a-5d9c-495a-9649-0140516b91b6'. Send an interactive authorization request for this user and resource. Trace ID: a6901b0e-f39c-481a-b1ee-365a2cf61a6a Correlation ID: 3928214f-ec91-4df1-9e43-c876dfc4000f Timestamp: 2016-10-05 13:12:43Z

I have registered the application in Azure Active Directory, and I am using "Application ID" of the registered application to pass it as a Client ID in HttpRequestMessage.

What could be the possible reason for this issue?

Any help on this will be much appreciated.

thanks


Solution

  • MSFT has a pretty detailed walkthrough here. Make sure you've gone through steps 10 and 11:

    1. Click Add application and then set the app permissions as shown in the following figure. Select the + icon on the Dynamics CRM Online line item and then select the check mark to exit the dialog. Set permissions to the CRM Online application

    2. In the Dynamics CRM Online Delegated Permissions drop down list, check Access CRM Online as organization users. Add application permission in Dynamics CRM For more information about registering an app with Azure Active Directory see Adding an Application.

    NOTE: If your o365 subscription for MSCRM is separate from Azure AD you can associate the 2 accounts by following the steps here.