你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Group User - Create

将现有用户添加到现有组

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}/users/{userId}?api-version=2022-08-01

URI 参数

名称 必需 类型 说明
groupId
path True

string

组标识符。 在当前API 管理服务实例中必须是唯一的。

resourceGroupName
path True

string

资源组的名称。 此名称不区分大小写。

serviceName
path True

string

API 管理服务的名称。

Regex pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

目标订阅的 ID。

userId
path True

string

用户标识符。 在当前API 管理服务实例中必须是唯一的。

api-version
query True

string

要用于此操作的 API 版本。

响应

名称 类型 说明
200 OK

UserContract

指定的用户已是指定组的成员。

201 Created

UserContract

已成功将用户添加到组。

Other Status Codes

ErrorResponse

描述操作失败原因的错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

ApiManagementCreateGroupUser

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/tempgroup/users/59307d350af58404d8a26300?api-version=2022-08-01

Sample Response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/59307d350af58404d8a26300",
  "type": "Microsoft.ApiManagement/service/groups/users",
  "name": "59307d350af58404d8a26300",
  "properties": {
    "firstName": "test",
    "lastName": "user",
    "email": "testuser1@live.com",
    "state": "active",
    "registrationDate": "2017-06-01T20:46:45.437Z",
    "groups": [],
    "identities": []
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/59307d350af58404d8a26300",
  "type": "Microsoft.ApiManagement/service/groups/users",
  "name": "59307d350af58404d8a26300",
  "properties": {
    "firstName": "test",
    "lastName": "user",
    "email": "testuser1@live.com",
    "state": "active",
    "registrationDate": "2017-06-01T20:46:45.437Z",
    "groups": [],
    "identities": []
  }
}

定义

名称 说明
ErrorFieldContract

错误字段协定。

ErrorResponse

错误响应。

GroupContractProperties

组协定属性。

GroupType

组类型。

UserContract

用户详细信息。

UserIdentityContract

用户标识详细信息。

UserState

帐户状态。 指定用户是否处于活动状态。 被阻止的用户无法登录开发人员门户或调用已订阅产品的任何 API。 默认状态为“活动”。

ErrorFieldContract

错误字段协定。

名称 类型 说明
code

string

属性级错误代码。

message

string

属性级错误的可读表示形式。

target

string

属性名称。

ErrorResponse

错误响应。

名称 类型 说明
error.code

string

服务定义的错误代码。 此代码用作响应中指定的 HTTP 错误代码的子状态。

error.details

ErrorFieldContract[]

在发生验证错误的情况下,在请求中发送的无效字段列表。

error.message

string

错误的用户可读表示形式。

GroupContractProperties

组协定属性。

名称 类型 说明
builtIn

boolean

如果组是管理员、开发人员或来宾) (三个系统组之一,则为 true;否则为 false。

description

string

组说明。 可以包含采用 HTML 格式的标记。

displayName

string

组名称。

externalId

string

对于外部组,此属性包含来自外部标识提供者(例如 Azure Active Directory aad://<tenant>.onmicrosoft.com/groups/<group object id>)的组 ID;否则值为 null。

type

GroupType

组类型。

GroupType

组类型。

名称 类型 说明
custom

string

external

string

system

string

UserContract

用户详细信息。

名称 类型 默认值 说明
id

string

资源的完全限定的资源 ID。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

资源的名称

properties.email

string

电子邮件地址。

properties.firstName

string

名字。

properties.groups

GroupContractProperties[]

用户所属的组集合。

properties.identities

UserIdentityContract[]

用户标识的集合。

properties.lastName

string

姓氏。

properties.note

string

有关管理员设置的用户的可选备注。

properties.registrationDate

string

用户注册的日期。 日期符合以下格式: yyyy-MM-ddTHH:mm:ssZ 由 ISO 8601 标准指定。

properties.state

UserState

active

帐户状态。 指定用户是否处于活动状态。 被阻止的用户无法登录开发人员门户或调用已订阅产品的任何 API。 默认状态为“活动”。

type

string

资源类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

UserIdentityContract

用户标识详细信息。

名称 类型 说明
id

string

提供程序中的标识符值。

provider

string

标识提供者名称。

UserState

帐户状态。 指定用户是否处于活动状态。 被阻止的用户无法登录开发人员门户或调用已订阅产品的任何 API。 默认状态为“活动”。

名称 类型 说明
active

string

用户状态为活动状态。

blocked

string

用户被阻止。 被阻止的用户无法在开发人员门户或调用 API 上进行身份验证。

deleted

string

用户帐户已关闭。 删除所有标识和相关实体。

pending

string

用户帐户处于挂起状态。 需要标识确认才能激活。