All Products
Search
Document Center

Resource Access Management:SetPasswordPolicy

Last Updated:Mar 11, 2024

Configures the password policy for RAM users, including the password strength.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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.
OperationAccess levelResource typeCondition keyAssociated operation
ram:SetPasswordPolicyWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
MinimumPasswordLengthintegerNo

The minimum required number of characters in a password.

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

12
RequireLowercaseCharactersbooleanNo

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

true
RequireUppercaseCharactersbooleanNo

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

true
RequireNumbersbooleanNo

Specifies whether a password must contain one or more digits.

true
RequireSymbolsbooleanNo

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

true
HardExpirybooleanNo

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
MaxPasswordAgeintegerNo

The number of days for which a password is valid. Default value: 0. The default value indicates that the password never expires.

0
PasswordReusePreventionintegerNo

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
MaxLoginAttempsintegerNo

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 parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

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

The password policy.

RequireNumbersboolean

Indicates whether a password must contain one or more digits.

true
RequireLowercaseCharactersboolean

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

true
HardExpiryboolean

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
PasswordReusePreventioninteger

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
RequireSymbolsboolean

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

true
MaxPasswordAgeinteger

The number of days for which a password is valid. Default value: 0. The default value indicates that the password never expires.

0
MinimumPasswordLengthinteger

The minimum required number of characters in a password.

12
RequireUppercaseCharactersboolean

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

true
MaxLoginAttempsinteger

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

Sample success responses

JSONformat

{
  "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 codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history