All Products
Search
Document Center

Resource Access Management:SetPasswordPolicy

Last Updated:Jan 28, 2026

Configures the password policy for Resource Access Management (RAM) users, including the password strength.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ram:SetPasswordPolicy

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

MinimumPasswordLength

integer

No

The minimum number of characters in a password.

Valid values: 8 to 32. Default value: 8.

12

RequireLowercaseCharacters

boolean

No

Specifies whether a password must contain one or more lowercase letters.

true

RequireUppercaseCharacters

boolean

No

Specifies whether a password must contain one or more uppercase letters.

true

RequireNumbers

boolean

No

Specifies whether a password must contain one or more digits.

true

RequireSymbols

boolean

No

Specifies whether a password must contain one or more special characters.

true

HardExpiry

boolean

No

Specifies whether a password will expire. Valid values: true and false. Default value: false. If you leave this parameter unspecified, the default value false is used.

  • If you set this parameter to true, the Alibaba Cloud account to which the RAM users belong must reset the passwords before the RAM users can log on to the Alibaba Cloud Management Console.

  • If you set this parameter to false, the RAM users can change the passwords after the passwords expire and then log on to the Alibaba Cloud Management Console.

false

MaxPasswordAge

integer

No

The number of days for which a password is valid. If you reset a password, the password validity period restarts. Default value: 0. The default value indicates that the password never expires.

0

PasswordReusePrevention

integer

No

The number of previous passwords that a RAM user is prevented from reusing. Default value: 0. The default value indicates that the RAM user can reuse previous passwords.

0

MaxLoginAttemps

integer

No

The maximum number of permitted logon attempts within one hour. The number of logon attempts is reset to zero if a RAM user changes the password.

5

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

04F0F334-1335-436C-A1D7-6C044FE73368

PasswordPolicy

object

The password policy.

RequireNumbers

boolean

Indicates whether a password must contain one or more digits.

true

RequireLowercaseCharacters

boolean

Indicates whether a password must contain one or more lowercase letters.

true

HardExpiry

boolean

Indicates whether a password expires. Valid values: true and false. Default value: false. If the parameter is unspecified, the default value false is returned.

  • If this parameter is set to true, the Alibaba Cloud account to which the RAM users belong must reset the password before the RAM users can log on to the Alibaba Cloud Management Console.

  • If this parameter is set to false, the RAM users can change the passwords after the passwords expire and then log on to the Alibaba Cloud Management Console.

false

PasswordReusePrevention

integer

The number of previous passwords that a RAM user is prevented from reusing. Default value: 0. The default value indicates that the RAM user can reuse previous passwords.

0

RequireSymbols

boolean

Indicates whether a password must contain one or more special characters.

true

MaxPasswordAge

integer

The number of days for which a password is valid. If you reset a password, the password validity period restarts. Default value: 0. The default value indicates that the password never expires.

0

MinimumPasswordLength

integer

The minimum number of characters in a password.

12

RequireUppercaseCharacters

boolean

Indicates whether a password must contain one or more uppercase letters.

true

MaxLoginAttemps

integer

The maximum number of permitted logon attempts within one hour. The number of logon attempts is reset to zero if a RAM user changes the password.

5

Examples

Success response

JSON format

{
  "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
  "PasswordPolicy": {
    "RequireNumbers": true,
    "RequireLowercaseCharacters": true,
    "HardExpiry": false,
    "PasswordReusePrevention": 0,
    "RequireSymbols": true,
    "MaxPasswordAge": 0,
    "MinimumPasswordLength": 12,
    "RequireUppercaseCharacters": true,
    "MaxLoginAttemps": 5
  }
}

Error response

JSON format

{
    "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
    "PasswordPolicy": {
        "MinimumPasswordLength": 12,
        "RequireLowercaseCharacters": true,
        "RequireUppercaseCharacters": true,
        "RequireNumbers": true,
        "RequireSymbols": true
    }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.