Creates a Resource Access Management (RAM) user.

This topic provides an example on how to create a RAM user named test.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateUser

The operation that you want to perform. Set the value to CreateUser.

UserPrincipalName String Yes test@example.onaliyun.com

The logon name of the RAM user.

The name is in the format of <username>@<AccountAlias>.onaliyun.com. <username> indicates the name of the RAM user. <AccountAlias>.onaliyun.com indicates the default domain name. For more information about how to obtain the default domain name, see GetDefaultDomain.

The value of UserPrincipalName must be 1 to 128 characters in length and can contain letters, digits, periods (.), hyphens (-), and underscores (_). The value of <AccountAlias>.onaliyun.com must be 1 to 64 characters in length.

DisplayName String Yes test

The display name of the RAM user.

The name must be 1 to 24 characters in length.

MobilePhone String No 86-1868888****

The mobile phone number of the RAM user.

Format: Country code-Mobile phone number.

Note This parameter is valid only on the China site (aliyun.com).
Email String No alice@example.com

The email address of the RAM user.

Note This parameter is valid only on the China site (aliyun.com).
Comments String No This is a cloud computing engineer.

The description.

The description must be 1 to 128 characters in length.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
User Object

The information about the RAM user.

DisplayName String test

The display name of the RAM user.

UserPrincipalName String test@example.onaliyun.com

The logon name of the RAM user.

Email String alice@example.com

The email address of the RAM user.

Note This parameter is valid only on the China site (aliyun.com).
UpdateDate String 2020-10-12T09:12:00Z

The time when the information about the RAM user was updated.

MobilePhone String 86-1868888****

The mobile phone number of the RAM user.

Note This parameter is valid only on the China site (aliyun.com).
UserId String 20732900249392****

The ID of the RAM user.

Comments String This is a cloud computing engineer.

The description.

LastLoginDate String 2020-10-12T09:12:00Z

The last time when the RAM user logged on to the console.

CreateDate String 2020-10-12T09:12:00Z

The time when the RAM user was created.

RequestId String 2BB8C44A-2862-4922-AD43-03924749173B

The ID of the request.

Examples

Sample requests

https://[Endpoint]/?Action=CreateUser
&UserPrincipalName=test@example.onaliyun.com
&DisplayName=test
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<CreateUserResponse>
	<User>
		<UpdateDate>2020-10-12T09:12:00Z</UpdateDate>
		<Email>alice@example.com</Email>
		<Comments>This is a cloud computing engineer.</Comments>
		<UserId>20732900249392****</UserId>
		<LastLoginDate>2020-10-12T09:12:00Z</LastLoginDate>
		<DisplayName>test</DisplayName>
		<UserPrincipalName>test@example.onaliyun.com</UserPrincipalName>
		<CreateDate>2020-10-12T09:12:00Z</CreateDate>
		<MobilePhone>86-1868888****</MobilePhone>
	</User>
	<RequestId>2BB8C44A-2862-4922-AD43-03924749173B</RequestId>
</CreateUserResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "User" : {
    "UpdateDate" : "2020-10-12T09:12:00Z",
    "Email" : "alice@example.com",
    "Comments" : "This is a cloud computing engineer.",
    "UserId" : "20732900249392****",
    "LastLoginDate" : "2020-10-12T09:12:00Z",
    "DisplayName" : "test",
    "UserPrincipalName" : "test@example.onaliyun.com",
    "CreateDate" : "2020-10-12T09:12:00Z",
    "MobilePhone" : "86-1868888****"
  },
  "RequestId" : "2BB8C44A-2862-4922-AD43-03924749173B"
}

Error codes

For a list of error codes, visit the API Error Center.