列出 directoryRoles
命名空间:microsoft.graph
注意
Microsoft建议使用统一的 RBAC API 而不是此 API。 统一的 RBAC API 提供更多的功能和灵活性。 有关详细信息,请参阅 List roleDefinitions。
列出租户中激活的目录角色。
此操作仅返回已激活的角色。 当管理员使用 Activate directoryRole API 激活角色时,角色将激活。 并非所有内置角色最初都会激活。
使用 Microsoft Entra 管理中心 分配角色时,角色激活步骤是代表管理员隐式完成的。 若要获取 Microsoft Entra ID 中可用的角色的完整列表,请使用 List directoryRoleTemplates。
此 API 可用于以下国家级云部署。
全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 | 最低特权权限 | 更高特权权限 |
---|---|---|
委派(工作或学校帐户) | RoleManagement.Read.Directory | RoleManagement.ReadWrite.Directory、Directory.Read.All、Directory.ReadWrite.All |
委派(个人 Microsoft 帐户) | 不支持。 | 不支持。 |
应用程序 | RoleManagement.Read.Directory | RoleManagement.ReadWrite.Directory、Directory.Read.All、Directory.ReadWrite.All |
HTTP 请求
GET /directoryRoles
可选的查询参数
此方法支持 $select
、 $filter
(eq
仅) 和 $expand
OData 查询参数 来帮助自定义响应。
请求标头
名称 | 说明 |
---|---|
Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在 200 OK
响应正文中返回响应代码和 directoryRole 对象的集合。
示例
请求
GET https://graph.microsoft.com/v1.0/directoryRoles
响应
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryRoles",
"value": [
{
"id": "9ed3a0c4-53e1-498c-ab4d-2473476fde14",
"deletedDateTime": null,
"description": "Can manage all aspects of Azure AD and Microsoft services that use Azure AD identities.",
"displayName": "Global Administrator",
"roleTemplateId": "62e90394-69f5-4237-9190-012177145e10"
},
{
"id": "f8e85ed8-f66f-4058-b170-3efae8b9c6e5",
"deletedDateTime": null,
"description": "Device Administrators",
"displayName": "Azure AD Joined Device Local Administrator",
"roleTemplateId": "9f06204d-73c1-4d4c-880a-6edb90606fd8"
},
{
"id": "fe8f10bf-c9c2-47eb-95cb-c26cc85f1830",
"deletedDateTime": null,
"description": "Can read basic directory information. Commonly used to grant directory read access to applications and guests.",
"displayName": "Directory Readers",
"roleTemplateId": "88d8e3e3-8f55-4a1e-953a-9b9898b8876b"
}
]
}