创建 inheritablePermission

命名空间:microsoft.graph

重要

Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

代理标识蓝图创建新的 inheritablePermission 对象。

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) AgentIdentityBlueprint.Create AgentIdentityBlueprint.ReadWrite.All、Directory.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 AgentIdentityBlueprint.Create AgentIdentityBlueprint.ReadWrite.All、Directory.ReadWrite.All

重要

AgentIdentity* 权限当前无法通过Microsoft Entra 管理中心上的 API 权限体验获得同意。 若要使用这些权限,可以通过Microsoft图形 API调用来同意这些权限,如以编程方式授予或撤销 API 权限中所述。 有关这些 权限的详细信息,请参阅管理代理标识 的权限。

使用委托权限时,必须为经过身份验证的用户分配受支持的Microsoft Entra角色或具有支持的角色权限的自定义角色。 此作支持以下最低特权角色。

  • 代理 ID 管理员。
  • 代理 ID 开发人员 - 创建代理标识蓝图。 具有此角色的主体被分配为其创建的蓝图的所有权,并且可以对该蓝图执行写入作。

HTTP 请求

POST /applications/{id}/microsoft.graph.agentIdentityBlueprint/inheritablePermissions

请求标头

名称 说明
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权
Content-Type application/json. 必需。

请求正文

在请求正文中,提供 inheritablePermission 对象的 JSON 表示形式。

创建 inheritablePermission 时,可以指定以下属性。

属性 类型 说明
resourceAppId String 发布作用域的资源应用程序的 appId。 必填。
inheritableScopes inheritableScopes 定义从资源应用程序委托的权限范围可由代理标识自动继承的继承配置。 指定模式之一: allAllowedScopes) 的所有范围 (, enumeratedScopes (仅列出 scopes 集合;必须存在且非空) ,或 noScopes (继承任何) 。 必填。

响应

如果成功,此方法在响应正文中返回响应 201 Created 代码和 inheritablePermission 对象。

示例

示例 1:使用 allAllowedScopes 模式创建 inheritablePermission

此示例创建一个 inheritablePermission,它允许代理标识继承来自资源应用程序的所有委托权限范围。

请求

以下示例显示了一个请求。

POST https://graph.microsoft.com/beta/applications/bc057821-f236-49d6-9f2c-1ebf43e9437a/microsoft.graph.agentIdentityBlueprint/inheritablePermissions
Content-Type: application/json

{
  "resourceAppId": "00000003-0000-0000-c000-000000000000",
  "inheritableScopes": {
    "@odata.type": "microsoft.graph.allAllowedScopes"
  }
}

响应

以下示例显示了相应的响应。

注意:为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
  "@odata.type": "#microsoft.graph.inheritablePermission",
  "resourceAppId": "00000003-0000-0000-c000-000000000000",
  "inheritableScopes": {
    "@odata.type": "microsoft.graph.allAllowedScopes",
    "kind": "allAllowed"
  }
}

示例 2:使用 enumeratedScopes 模式创建 inheritablePermission

此示例创建一个 inheritablePermission,它仅允许代理标识继承资源应用程序中的指定委托权限范围。

请求

以下示例显示了一个请求。

POST https://graph.microsoft.com/beta/applications/bc057821-f236-49d6-9f2c-1ebf43e9437a/microsoft.graph.agentIdentityBlueprint/inheritablePermissions
Content-Type: application/json

{
  "resourceAppId": "00000003-0000-0000-c000-000000000000",
  "inheritableScopes": {
    "@odata.type": "microsoft.graph.enumeratedScopes",
    "scopes": [
      "User.Read",
      "Mail.Read"
    ]
  }
}

响应

以下示例显示了相应的响应。

注意:为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
  "@odata.type": "#microsoft.graph.inheritablePermission",
  "resourceAppId": "00000003-0000-0000-c000-000000000000",
  "inheritableScopes": {
    "@odata.type": "microsoft.graph.enumeratedScopes",
    "kind": "enumerated",
    "scopes": [
      "User.Read",
      "Mail.Read"
    ]
  }
}

示例 3:使用 noScopes 模式创建 inheritablePermission

此示例创建一个 inheritablePermission,该权限范围阻止资源应用程序中的所有委托权限范围可由代理标识继承。

请求

以下示例显示了一个请求。

POST https://graph.microsoft.com/beta/applications/bc057821-f236-49d6-9f2c-1ebf43e9437a/microsoft.graph.agentIdentityBlueprint/inheritablePermissions
Content-Type: application/json

{
  "resourceAppId": "00000003-0000-0000-c000-000000000000",
  "inheritableScopes": {
    "@odata.type": "microsoft.graph.noScopes"
  }
}

响应

以下示例显示了相应的响应。

注意:为了提高可读性,可能缩短了此处显示的响应对象。

HTTP/1.1 201 Created
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#applications('bc057821-f236-49d6-9f2c-1ebf43e9437a')/inheritablePermissions/$entity",
  "@odata.type": "#microsoft.graph.inheritablePermission",
  "resourceAppId": "00000003-0000-0000-c000-000000000000",
  "inheritableScopes": {
    "@odata.type": "microsoft.graph.noScopes"
  }
}