从Windows桌面应用程序使用REST API访问CRM实例时出错

问题描述:

尝试从Windows桌面应用程序中使用REST API从CRM实例检索数据时遇到以下错误.

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

AADSTS65001:用户或管理员不同意使用ID为'4cdb6f7a-5d9c-495a-9649-0140516b91b6'的应用程序.发送一个此用户和资源的交互式授权请求.痕迹ID:a6901b0e-f39c-481a-b1ee-365a2cf61a6a相关ID:3928214f-ec91-4df1-9e43-c876dfc4000f时间戳:2016-10-05 13:12:43Z

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

我已经在Azure Active Directory中注册了该应用程序,并且正在使用已注册应用程序的应用程序ID"将其作为客户端ID传递到HttpRequestMessage中.

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.

谢谢

MSFT具有相当详细的演练此处.确保您已完成步骤10和11:

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

  1. 单击添加应用程序",然后如下图所示设置应用程序权限.选择"Dynamics CRM Online"行项目上的+图标,然后选择复选标记以退出对话框.设置对CRM Online应用程序的权限

  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

在"Dynamics CRM Online委派的权限"下拉列表中,选中作为组织用户的Access CRM Online.在Dynamics CRM中添加应用程序权限有关在Azure Active Directory中注册应用程序的更多信息,请参见添加应用程序.

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.

注意::如果您的MSCRM的o365订阅与Azure AD是分开的,则可以按照步骤

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