All Products
Search
Document Center

Resource Access Management:SetSecurityPreference

Last Updated:Mar 11, 2024

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.

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:SetSecurityPreferenceWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
EnableSaveMFATicketbooleanNo

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.
true
AllowUserToChangePasswordbooleanNo

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.
true
AllowUserToManageAccessKeysbooleanNo

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.
false
AllowUserToManagePublicKeysbooleanNo

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.
false
AllowUserToManageMFADevicesbooleanNo

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.
true
LoginSessionDurationintegerNo

The validity period of the logon session of RAM users.

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

6
LoginNetworkMasksstringNo

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.

10.0.0.0/8

Response parameters

ParameterTypeDescriptionExample
object
SecurityPreferenceobject

The security preferences.

AccessKeyPreferenceobject

The AccessKey pair preference.

AllowUserToManageAccessKeysboolean

Indicates whether RAM users can manage their AccessKey pairs.

false
MFAPreferenceobject

The MFA preference.

AllowUserToManageMFADevicesboolean

Indicates whether RAM users can manage their MFA devices.

false
LoginProfilePreferenceobject

The logon preference.

EnableSaveMFATicketboolean

Indicates whether the MFA devices of RAM users are remembered.

false
LoginSessionDurationinteger

The validity period of the logon session of RAM users.

6
LoginNetworkMasksstring

The subnet mask.

10.0.0.0/8
AllowUserToChangePasswordboolean

Indicates whether RAM users can change their passwords.

true
PublicKeyPreferenceobject

The public key preference.

Note This parameter is valid only for the Japan site.
AllowUserToManagePublicKeysboolean

Indicates whether RAM users can manage their public keys.

false
RequestIdstring

The ID of the request.

A978915D-F279-4CA0-A89B-9A71219FFB3E

Examples

Sample success responses

JSONformat

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

Error codes

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

Change history

Change timeSummary of changesOperation
No change history