创建标识

命名空间:microsoft.graph.externalConnectors

externalGroup 中为新成员创建标识资源。

权限

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限

权限类型 权限(从最低特权到最高特权)
委派(工作或学校帐户) ExternalItem.ReadWrite.OwnedBy、ExternalItem.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持
Application ExternalItem.ReadWrite.OwnedBy、ExternalItem.ReadWrite.All

HTTP 请求

POST /external/connections/{connectionsId}/groups/{externalGroupId}/members

请求标头

名称 说明
Authorization Bearer {token}。必需。
Content-Type application/json. Required.

请求正文

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

在为 externalGroup 中的成员创建 标识 资源时,可以指定以下属性。

属性 类型 说明
id String 成员的唯 id 一。 如果是 Azure Active Directory 用户或组,则为 objectId ,对于外部组,则为 externalGroupId 。 此为必需属性。
type microsoft.graph.externalConnectors.identityType 添加到外部组的成员的类型。 可能的值为: usergroupexternalGroup. 必需。

响应

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

示例

示例 1:将 Azure Active Directory 用户添加为成员

请求

POST https://graph.microsoft.com/v1.0/external/connections/contosohr/groups/31bea3d537902000/members
Content-Type: application/json

{
  "id": "e811976d-83df-4cbd-8b9b-5215b18aa874",
  "type": "user"
}

响应

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

{
  "id": "e811976d-83df-4cbd-8b9b-5215b18aa874",
  "type": "user"
}

示例 2:将 Azure Active Directory 组添加为成员

请求

POST https://graph.microsoft.com/v1.0/external/connections/contosohr/groups/31bea3d537902000/members
Content-Type: application/json

{
  "id": "e5477431-1038-484e-bf69-1dfedb97a110",
  "type": "group"
}

响应

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

{
  "id": "e5477431-1038-484e-bf69-1dfedb97a110",
  "type": "group"
}

示例 3:将另一个外部组添加为成员

请求

POST https://graph.microsoft.com/v1.0/external/connections/contosohr/groups/31bea3d537902000/members
Content-Type: application/json

{
  "id": "1431b9c38ee647f6a",
  "type": "externalGroup",
}

响应

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

{
  "id": "14m1b9c38qe647f6a",
  "type": "externalGroup"
}