Creates a directory.

Usage notes

A directory is a CloudSSO instance. Before you can use CloudSSO, you must create a directory. The directory is used to manage all CloudSSO resources.

To create a directory, you must select a region. Alibaba Cloud stores data in the directory only in the region that you select. However, you can deploy Alibaba Cloud resources including Elastic Compute Service (ECS) instances and ApsaraDB RDS instances in other regions. You can also use your cloud account for logons and access the Alibaba Cloud resources in other regions. You can select a region to create a directory based on your security compliance requirements and the geographic location of specific users. If you do not have strict security compliance requirements, we recommend that you select a region that is the closest to the geographical location of the specific users. This way, access to cloud resources is accelerated. You can create the CloudSSO directory in the China (Shanghai), China (Hong Kong), US (Silicon Valley), or Germany (Frankfurt) region.

This topic provides an example on how to create a directory named example in the China (Shanghai) region.

Limits

  • You can create only one directory for a management account.
  • If you want to change the region of a directory, you must delete the directory and then create a directory in a different region.

Limits

You can call this operation up to 100 times per second per account. This operation is globally limited to 100 times per second across all accounts. If the number of the calls per second exceeds a limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limits when you call this operation.

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 CreateDirectory

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

DirectoryName String No example

The name of the directory. The name must be globally unique.

The name can contain lowercase letters, digits, and hyphens (-). The name cannot start or end with a hyphen (-) and cannot contain two consecutive hyphens (-). The name cannot start with d-.

The name must be 2 to 64 characters in length.

Note If you do not specify this parameter, the value of this parameter is automatically generated by the system.

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

Response parameters

Parameter Type Example Description
RequestId String ADADC31D-90EE-5459-99B0-D83DF07769A3

The ID of the request.

Directory Object

The information about the directory.

DirectoryId String d-00fc2p61****

The ID of the directory.

CreateTime String 2021-10-10T04:04:04Z

The time when the directory was created. The time is displayed in UTC.

UpdateTime String 2021-10-10T04:04:04Z

The time when the directory was modified. The time is displayed in UTC.

Region String cn-shanghai

The region ID of the directory.

DirectoryName String example

The name of the directory.

Examples

Sample requests

https://cloudsso.cn-shanghai.aliyuncs.com/?Action=CreateDirectory
&DirectoryName=example
&<Common request parameters>

Sample success responses

XML format

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

<CreateDirectoryResponse>
    <RequestId>ADADC31D-90EE-5459-99B0-D83DF07769A3</RequestId>
    <Directory>
        <DirectoryId>d-00fc2p61****</DirectoryId>
        <CreateTime>2021-10-10T04:04:04Z</CreateTime>
        <UpdateTime>2021-10-10T04:04:04Z</UpdateTime>
        <Region>cn-shanghai</Region>
        <DirectoryName>example</DirectoryName>
    </Directory>
</CreateDirectoryResponse>

JSON format

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

{
  "RequestId" : "ADADC31D-90EE-5459-99B0-D83DF07769A3",
  "Directory" : {
    "DirectoryId" : "d-00fc2p61****",
    "CreateTime" : "2021-10-10T04:04:04Z",
    "UpdateTime" : "2021-10-10T04:04:04Z",
    "Region" : "cn-shanghai",
    "DirectoryName" : "example"
  }
}

Error codes

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