Configures the security preferences.

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 SetSecurityPreference

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

EnableSaveMFATicket Boolean No true

Specifies whether to remember the multi-factor authentication (MFA) devices of Resource Access Management (RAM) users for seven days. Valid values:

  • true: remembers the MFA devices of RAM users for seven days.
  • false: does not remember the MFA devices of RAM users for seven days.
AllowUserToChangePassword Boolean No true

Specifies whether RAM users can change their passwords. Valid values:

  • true: RAM users can change their passwords. This is the default value.
  • false: RAM users cannot change their passwords.
AllowUserToManageAccessKeys Boolean No false

Specifies whether RAM users can manage their AccessKey pairs. Valid values:

  • true: RAM users can manage their AccessKey pairs.
  • false: RAM users cannot manage their AccessKey pairs. This is the default value.
AllowUserToManagePublicKeys Boolean No false

Specifies whether RAM users can manage their public keys. Valid values:

  • true: RAM users can manage their public keys.
  • false: RAM users cannot manage their public keys. This is the default value.
Note This parameter is valid only for the Japan site.
AllowUserToManageMFADevices Boolean No true

Specifies whether RAM users can manage their MFA devices. Valid values:

  • true: RAM users can manage their MFA devices. This is the default value.
  • false: RAM users cannot manage their MFA devices.
LoginSessionDuration Integer No 6

The validity period of the logon session of RAM users.

Valid values: 1 to 24. Default value: 6. Unit: hours.

LoginNetworkMasks String No 10.0.0.0/8

The subnet mask that specifies the IP addresses from which you can log on to the Alibaba Cloud Management Console. This parameter takes effect on password-based logon and single sign-on (SSO). However, this parameter does not take effect on API calls that are authenticated by using AccessKey pairs.

  • If you specify a subnet mask, RAM users can use only the IP addresses in the subnet mask to log on to the Alibaba Cloud Management Console.
  • If you do not specify a subnet mask, RAM users can use all IP addresses to log on to the Alibaba Cloud Management Console.

If you need to specify multiple subnet masks, separate the subnet masks with semicolons (;). Example: 192.168.0.0/16;10.0.0.0/8.

You can specify up to 25 subnet masks. The total length of the subnet masks can be a maximum of 512 characters.

Response parameters

Parameter Type Example Description
SecurityPreference Object

The security preferences.

AccessKeyPreference Object

The AccessKey pair preference.

AllowUserToManageAccessKeys Boolean false

Indicates whether RAM users can manage their AccessKey pairs.

MFAPreference Object

The MFA preference.

AllowUserToManageMFADevices Boolean false

Indicates whether RAM users can manage their MFA devices.

LoginProfilePreference Object

The logon preference.

EnableSaveMFATicket Boolean false

Indicates whether the MFA devices of RAM users are remembered.

LoginSessionDuration Integer 6

The validity period of the logon session of RAM users.

LoginNetworkMasks String 10.0.0.0/8

The subnet mask.

AllowUserToChangePassword Boolean true

Indicates whether RAM users can change their passwords.

PublicKeyPreference Object

The public key preference.

Note This parameter is valid only for the Japan site.
AllowUserToManagePublicKeys Boolean false

Indicates whether RAM users can manage their public keys.

RequestId String A978915D-F279-4CA0-A89B-9A71219FFB3E

The ID of the request.

Examples

Sample requests

https://ram.aliyuncs.com/?Action=SetSecurityPreference
&<Common request parameters>

Sample success responses

XML format

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

<?xml version="1.0" encoding="UTF-8" ?>
<SetSecurityPreferenceResponse>
	<SecurityPreference>
		<LoginProfilePreference>
			<LoginSessionDuration>6</LoginSessionDuration>
			<LoginNetworkMasks></LoginNetworkMasks>
			<AllowUserToChangePassword>true</AllowUserToChangePassword>
			<EnableSaveMFATicket>false</EnableSaveMFATicket>
		</LoginProfilePreference>
		<AccessKeyPreference>
			<AllowUserToManageAccessKeys>false</AllowUserToManageAccessKeys>
		</AccessKeyPreference>
		<PublicKeyPreference>
			<AllowUserToManagePublicKeys>false</AllowUserToManagePublicKeys>
		</PublicKeyPreference>
		<MFAPreference>
			<AllowUserToManageMFADevices>true</AllowUserToManageMFADevices>
		</MFAPreference>
	</SecurityPreference>
	<RequestId>A978915D-F279-4CA0-A89B-9A71219FFB3E</RequestId>
</SetSecurityPreferenceResponse>

JSON format

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

{
  "SecurityPreference" : {
    "LoginProfilePreference" : {
      "LoginSessionDuration" : 6,
      "LoginNetworkMasks" : "",
      "AllowUserToChangePassword" : true,
      "EnableSaveMFATicket" : false
    },
    "AccessKeyPreference" : {
      "AllowUserToManageAccessKeys" : false
    },
    "PublicKeyPreference" : {
      "AllowUserToManagePublicKeys" : false
    },
    "MFAPreference" : {
      "AllowUserToManageMFADevices" : true
    }
  },
  "RequestId" : "A978915D-F279-4CA0-A89B-9A71219FFB3E"
}

Error codes

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