【发布时间】:2019-10-12 17:01:12
【问题描述】:
我正在使用 Azure AD B2C 创建用户。 创建用户后,我想将他们添加到组中
使用 Postman,我提出了以下请求(标头中带有访问令牌)。注意:我已经成功地使用 Api 创建了一个组。
发布
https://graph.windows.net/{azure-tenant}/groups/{group-objectId/members/$ref?api-version=1.6
有身体:
{
"@odata.id": "https://graph.windows.net/{azure-tenant}/directoryObjects/{user-objectId}"
}
这是文档指定的内容。无论发送的正文如何,我都会收到以下错误
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "The request URI is not valid. Since the segment 'members' refers to a collection, this must be the last segment in the request URI. All intermediate segments must refer to a single resource."
},
"requestId": "48cf65f3-20ba-411e-8121-f7ea54252f3a",
"date": "2019-05-27T06:09:25"
}
}
我尝试删除 /$ref
发布
https://graph.windows.net/{azure-tenant}/groups/{group-objectId/members?api-version=1.6
正文:
{
"@odata.id": "https://graph.windows.net/{azure-tenant}/directoryObjects/{user-objectId}"
}
还有
{
"@odata.id": "https://graph.windows.net/{azure-tenant}/users/{user-objectId}"
}
现在返回的错误是:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "Unsupported resource type 'DirectoryObject' for operation 'Create'."
},
"requestId": "2c36cc6d-383c-44f8-8609-2ac3e3efc862",
"date": "2019-05-27T06:15:26"
}
}
我一直在使用的文档https://docs.microsoft.com/en-us/graph/api/group-post-members?view=graph-rest-1.0&tabs=javascript
【问题讨论】:
标签: azure azure-ad-b2c azure-ad-graph-api