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.

Tag.N.Key String No operator

The key of tag N.

Valid values of N: 1 to 20. You cannot specify empty strings as tag keys. The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.

Tag.N.Value String No alice

The value of tag N.

Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be a up to128 characters in length and cannot contain http:// or https://. The tag value cannot start with acs:.

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 Alibaba Cloud Management Console.

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

The time when the RAM user was created.

ProvisionType String Manual

The source of the RAM user. Valid values:

  • Manual: The RAM user is manually created in the RAM console.
  • SCIM: The RAM user is mapped by using System for Cross-domain Identity Management (SCIM).
  • CloudSSO: The RAM user is mapped from a CloudSSO user.
Tags Array of Tag

An array that consists of the details of the returned tags.

Tag
TagKey String operator

The tag key.

TagValue String alice

The tag value.

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
&MobilePhone=86-1868888****
&Email=alice@example.com
&Comments=This is a cloud computing engineer.
&Tag.1.Key=operator
&Tag.1.Value=alice
&<Common request parameters>

Sample success responses

XML format

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

<CreateUserResponse>
    <User>
        <DisplayName>test</DisplayName>
        <UserPrincipalName>test@example.onaliyun.com</UserPrincipalName>
        <Email>alice@example.com</Email>
        <UpdateDate>2020-10-12T09:12:00Z</UpdateDate>
        <MobilePhone>86-1868888****</MobilePhone>
        <UserId>20732900249392****</UserId>
        <Comments>This is a cloud computing engineer.</Comments>
        <LastLoginDate>2020-10-12T09:12:00Z</LastLoginDate>
        <CreateDate>2020-10-12T09:12:00Z</CreateDate>
        <ProvisionType>Manual</ProvisionType>
        <Tags>
            <TagKey>operator</TagKey>
            <TagValue>alice</TagValue>
        </Tags>
    </User>
    <RequestId>2BB8C44A-2862-4922-AD43-03924749173B</RequestId>
</CreateUserResponse>

JSON format

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

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

Error codes

For a list of error codes, see Service error codes.