无法使用GraphServiceClient创建具有应用程序身份的在线会议 [英] Fail to create online meeting with application identity with GraphServiceClient
问题描述
我正在使用Azure AD的应用程序身份并同时授予读写权限,我还运行了Grant-CsApplicationAccessPolicy,以便该应用程序身份有权代表Azure AD的真实用户身份创建在线会议
I'm using an application identity from Azure AD with both read write permission granted, I've also run the Grant-CsApplicationAccessPolicy so that the application identity has right to create online meeting on behalf of a real user identity from Azure AD
我知道我的设置适用于来自图api的获取用户.但是,运行以下命令后出现错误:
I know my setup works with get user from the graph api. However, I'm getting error after running the following:
var confidentialClient = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithAuthority($"https://login.microsoftonline.com/{tenantId}/v2.0")
.WithClientSecret(clientSecret)
.Build();
GraphServiceClient graphServiceClient =
new GraphServiceClient("https://graph.microsoft.com/beta", new DelegateAuthenticationProvider(async (requestMessage) =>
{
var authResult = await confidentialClient
.AcquireTokenForClient(scopes)
.ExecuteAsync();
requestMessage.Headers.Authorization =
new AuthenticationHeaderValue("Bearer", authResult.AccessToken);
})
);
var onlineMeeting = new OnlineMeeting
{
StartDateTime = DateTimeOffset.Parse("2020-12-25T21:30:34.2444915+00:00"),
EndDateTime = DateTimeOffset.Parse("2020-12-25T22:00:34.2464912+00:00"),
Subject = "User Token Meeting 1"
};
var meetingInstance = await graphServiceClient.Me.OnlineMeetings
.Request()
.AddAsync(onlineMeeting);
错误消息如下,为什么会显示 在AAD中按用户ID查找用户失败 ?
The error message is as follow, why would it say User look up by user id failed in AAD?
状态:未找到(404)OperationId:8d06ff01-1dc3-49d1-9ced-9db6a919b162
Status: NotFound (404) OperationId: 8d06ff01-1dc3-49d1-9ced-9db6a919b162
ClientCorrelationId:53b4478e-ba86-48ca-bb5b-25e5ef50c187
ClientCorrelationId: 53b4478e-ba86-48ca-bb5b-25e5ef50c187
服务器错误:在AAD中按用户ID查找用户失败.
Server error: User lookup by user id failed in AAD.
客户端异常:HTTP请求的处理导致异常.有关详细信息,请参见此异常的'Response'属性返回的HTTP响应.
Client exception: Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
内部错误:
其他数据:
日期:2020-12-16T21:08:31
date: 2020-12-16T21:08:31
request-id:d60858cf-5ef5-4a0d-8d67-181f80ed6c35
request-id: d60858cf-5ef5-4a0d-8d67-181f80ed6c35
client-request-id:d60858cf-5ef5-4a0d-8d67-181f80ed6c35
client-request-id: d60858cf-5ef5-4a0d-8d67-181f80ed6c35
ClientRequestId:d60858cf-5ef5-4a0d-8d67-181f80ed6c35
ClientRequestId: d60858cf-5ef5-4a0d-8d67-181f80ed6c35
(HttpRequestMessage请求,HttpCompletionOptioncompleteOption,CancellationToken cancelledToken)在Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject,CancellationToken cancelToken,HttpCompletionOptioncompleteOption)在Microsoft.Graph.BaseRequest.SendAsync [T](对象serializableObject,CancellationToken cancelToken,HttpCompletionOption完成选项)在D:\ VSTS \ msteam \ MSTeam \ MSTeam \ Program.cs:line 62的MSTeam.Program.Main(String [] args)中
at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at MSTeam.Program.Main(String[] args) in D:\VSTS\msteam\MSTeam\MSTeam\Program.cs:line 62
推荐答案
Dev是正确的.