azure-active-directory - 如何通过 Graph API 将服务主体作为所有者添加到 Azure AD 组
问题描述
我的要求是在 Azure AD 中创建一个组,并通过 Graph API 添加一个服务主体作为该组的所有者 - 创建组时。
参考文档: https ://docs.microsoft.com/en-us/graph/api/group-post-groups?view=graph-rest-1.0&tabs=http
参考上述文档,我可以创建组,但显示的响应对象不允许将服务主体添加为所有者。
身体 :
{ "description": "测试 123", "displayName": "SG-test-ei",
“mailEnabled”:假,“mailNickname”:“SGP-test-ei”,“securityEnabled”:真,“owners@odata.bind”:[
"https://graph.microsoft.com/v1.0/users/qwbhty-cdd0-4c42-b857-5b8ce0ae6a9e"
],
"members@odata.bind": [
"https://graph.microsoft.com/v1.0/users/7f3f587a-c40a-4a63-82b1-202f35c828ee"
]
}
似乎,https: //graph.microsoft.com/v1.0/users 无法识别服务主体的 ObjectID。
我的问题是,我应该在正文中使用哪些 owner@odata.bind 或 API 将服务主体作为所有者添加到 Azure AD 中的安全组。
解决方案
链接中的示例使用/users
.
POST https://graph.microsoft.com/v1.0/groups
Content-Type: application/json
{
"description": "Group with designated owner and members",
"displayName": "Operations group",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "operations2019",
"securityEnabled": false,
"owners@odata.bind": [
"https://graph.microsoft.com/v1.0/users/26be1845-4119-4801-a799-aea79d09f1a2"
],
"members@odata.bind": [
"https://graph.microsoft.com/v1.0/users/ff7cb387-6688-423c-8188-3da9532a73cc",
"https://graph.microsoft.com/v1.0/users/69456242-0067-49d3-ba96-9de6f2728e14"
]
}
将其替换为/servicePrincipals
如下所示:
"owners@odata.bind": [
"https://graph.microsoft.com/v1.0/servicePrincipals/00964c82-a7c2-4675-bbed-54bcf16328b3"
]
推荐阅读
- elasticsearch - Elasticsearch 特殊条件查询
- android - 当应用程序未在 Android 上运行时,使用 React Native 在状态栏上显示通知图标
- python - 在日志文件中获取具体日期并进行处理
- excel - Excel VB 和 XML 命名空间命名约定
- maven - Blackduck 扫描显示文件已被旧版本的 Jetty Http 修改
- wordpress - 联系表格 7 文件附件未附加到电子邮件
- xml - 如何使用配置变量在 NLog FileTarget 上配置 maxArchiveDays
- python - Python SQLite 查询总是返回 None
- azure - 所有这些 MS Azure 条款和结构之间的关系是什么?
- ssl - Openssl dnQualifier 哈希