配置代理身份蓝图的可继承权限,以预先授权一组基础的委托作用域和应用角色。 从蓝图创建的代理标识在未经交互式许可提示的情况下会自动继承这些权限。
有关可继承权限与所需资源访问和直接权限授予的关系的概念背景,请参阅 “可继承权限”和“所需的资源访问权限”。
先决条件
- 已创建和配置的现有代理标识蓝图
- 以下任一权限:
- 用于管理用户拥有的代理标识蓝图的代理 ID 开发人员角色
- 用于管理代理身份蓝图的代理 ID 管理员角色
可继承权限的工作原理
在代理标识的令牌颁发过程中,平台会将符合条件的继承范围与代理请求的委托范围合并。 继承的范围显示在访问令牌的 scp 声明中,继承的角色显示在 角色 声明中。 有关继承条件和声明、授予和有效权限之间的关系的详细信息,请参阅 “可继承的权限”和所需的资源访问权限。
继承模式
概念文章高度概述了继承模式。 下表显示了配置每个资源应用继承时 API 中使用的特定 kind 值:
| 继承 | 种类 | 说明 |
|---|---|---|
| 全部允许 | allAllowed |
继承指定资源应用的所有可用委派范围或应用程序角色。 在代理身份蓝图主体中,新授予的范围或角色将被自动包含。 |
| 没有 | none |
不继承指定资源应用的作用域或角色。 使用它可以单独禁用范围(noScopes)或角色(noRoles)的继承。 |
可以在同一资源上独立配置范围和角色。 例如,可以选择继承所有作用域但不继承任何角色,或者反之亦然。
可继承的权限限制
- 每个代理标识蓝图最多可包含 50 个资源应用(例如,inheritablePermissions 集合中最多可有 50 个条目)。 如果超出此限制,请减少资源应用数,以保留在受支持的边界内。
定期查看和监视可继承的权限配置。 重新评估继承的范围和角色,以确保它们仍然适合你的用例。 审核代理正在使用的继承范围和角色,并从代理标识蓝图主体和可继承的权限列表中删除任何未使用的权限,以维护安全卫生。
配置可继承的权限(使用Microsoft Graph)
若要配置可继承的权限,请在应用程序资源上使用 agentIdentityBlueprint inheritablePermissions 导航属性。 每个条目指定单个资源应用的作用域和角色继承配置。 通过记录每个范围或角色为何可继承以及由谁批准来跟踪配置决策,以便于审核。
在 resourceAppId 请求中指定时,请确保提供有效的 GUID 格式。 无效的 GUID 导致 400 错误请求。
添加所有作用域和角色继承到Microsoft Graph中
请求
POST https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions
Content-Type: application/json
OData-Version: 4.0
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "#microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "#microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
响应
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://microsoftgraph.chinacloudapi.cn/v1.0/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
为多个资源添加所有作用域和角色继承
可以为同一蓝图上的多个资源应用配置可继承的权限。 每个资源都需要单独的 POST 请求。 以下示例为 Microsoft Graph 和 SharePoint Online 添加继承。
Request (Microsoft Graph)
POST https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions
Content-Type: application/json
OData-Version: 4.0
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "#microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "#microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
响应
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://microsoftgraph.chinacloudapi.cn/v1.0/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
Request (SharePoint Online)
POST https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions
Content-Type: application/json
OData-Version: 4.0
{
"resourceAppId": "00000003-0000-0ff1-ce00-000000000000",
"inheritableScopes": {
"@odata.type": "#microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "#microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
响应
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://microsoftgraph.chinacloudapi.cn/v1.0/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
"resourceAppId": "00000003-0000-0ff1-ce00-000000000000",
"inheritableScopes": {
"@odata.type": "microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
仅添加范围继承(无角色)
若要继承委托的范围而不是应用程序角色,请将 inheritableRoles 设置为 noRoles。
请求
POST https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions
Content-Type: application/json
OData-Version: 4.0
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "#microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "#microsoft.graph.noRoles",
"kind": "none"
}
}
响应
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://microsoftgraph.chinacloudapi.cn/v1.0/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "microsoft.graph.noRoles",
"kind": "none"
}
}
仅添加角色继承(无范围)
若要继承应用程序角色,但不继承委托的范围,请设置为 inheritableScopesnoScopes。
请求
POST https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions
Content-Type: application/json
OData-Version: 4.0
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "#microsoft.graph.noScopes",
"kind": "none"
},
"inheritableRoles": {
"@odata.type": "#microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
响应
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.context": "https://microsoftgraph.chinacloudapi.cn/v1.0/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "microsoft.graph.noScopes",
"kind": "none"
},
"inheritableRoles": {
"@odata.type": "microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
更新以禁用角色继承
如果 resourceAppId 已存在条目,请使用 PATCH 更新它,而不是尝试创建重复条目,这将导致 409 冲突错误。 以下示例在保持启用范围继承的同时禁用角色继承。
请求
PATCH https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions/00000003-0000-0000-c000-000000000000
Content-Type: application/json
OData-Version: 4.0
{
"inheritableRoles": {
"@odata.type": "#microsoft.graph.noRoles",
"kind": "none"
}
}
响应
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://microsoftgraph.chinacloudapi.cn/v1.0/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "microsoft.graph.allAllowedScopes",
"kind": "allAllowed"
},
"inheritableRoles": {
"@odata.type": "microsoft.graph.noRoles",
"kind": "none"
}
}
更新以禁止范围的继承
以下示例禁用作用域继承,同时启用角色继承。
请求
PATCH https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions/00000003-0000-0000-c000-000000000000
Content-Type: application/json
OData-Version: 4.0
{
"inheritableScopes": {
"@odata.type": "#microsoft.graph.noScopes",
"kind": "none"
}
}
响应
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://microsoftgraph.chinacloudapi.cn/v1.0/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"inheritableScopes": {
"@odata.type": "microsoft.graph.noScopes",
"kind": "none"
},
"inheritableRoles": {
"@odata.type": "microsoft.graph.allAllowedRoles",
"kind": "allAllowed"
}
}
删除现有可继承权限
请求
DELETE https://microsoftgraph.chinacloudapi.cn/v1.0/applications/microsoft.graph.agentIdentityBlueprint/bc057821-f236-49d6-9f2c-1ebf43e9437a/inheritablePermissions/00000003-0000-0000-c000-000000000000
OData-Version: 4.0
响应
HTTP/1.1 204 No Content