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:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is 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 | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
DirectoryId | string | Yes | The ID of the directory. | d-00fc2p61**** |
UserName | string | Yes | The name of the user. The name must be unique within the directory. The name cannot be changed. The name can contain numbers, letters, and the following special characters: The name can be up to 64 characters in length. | Alice |
FirstName | string | No | The first name of the user. The name can be up to 64 characters in length. | Alice |
LastName | string | No | The last name of the user. The name can be up to 64 characters in length. | Lee |
DisplayName | string | No | The display name of the user. The 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
JSON
format
{
"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"
},
"RequestId": "F6F90F3D-4502-5877-B80B-97476F6AE2CC"
}
Error codes
For a list of error codes, visit the Service error codes.