Creates a user.
Operation description
This topic provides an example on how to create a user named Alice.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| cloudsso:CreateUser | create | *User acs:cloudsso:{#regionId}:{#accountId}:directory/{#DirectoryId}/user/* |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| DirectoryId | string | Yes | The ID of the directory. | d-00fc2p61**** |
| UserName | string | Yes | The username of the user. The username must be unique within the directory. and cannot be changed. The username can contain digits, letters, and the following special characters: The username can be up to 64 characters in length. | Alice |
| FirstName | string | No | The first name of the user. The first name can be up to 64 characters in length. | Alice |
| LastName | string | No | The last name of the user. The last name can be up to 64 characters in length. | Lee |
| DisplayName | string | No | The display name of the user. The display name can be up to 256 characters in length. | Alice |
| Description | string | No | The description of the user. The description can be up to 1,024 characters in length. | This is a user. |
| string | No | The email address of the user. The email address must be unique within the directory. The email address can be up to 128 characters in length. | Alice@example.com | |
| Status | string | No | The status of the user. Valid values:
| Enabled |
Response parameters
Examples
Sample success responses
JSONformat
{
"User": {
"Status": "Enabled",
"UserName": "Alice",
"Email": "Alice@example.com",
"Description": "This is a user.",
"UserId": "u-00q8wbq42wiltcrk****",
"FirstName": "Alice",
"CreateTime": "2021-10-26T03:03:42Z",
"ProvisionType": "Manual",
"DisplayName": "Alice",
"UpdateTime": "2021-10-26T03:03:42Z",
"LastName": "Lee",
"Tags": [
{
"Key": "",
"Value": ""
}
]
},
"RequestId": "F6F90F3D-4502-5877-B80B-97476F6AE2CC"
}Error codes
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|
