All Products
Search
Document Center

Resource Access Management:GetSecurityPreference

Last Updated:May 25, 2026

Use GetSecurityPreference to query the global security preferences of a RAM user.

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:GetSecurityPreference

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

No parameters required.

Response elements

Element

Type

Description

Example

object

The returned data.

SecurityPreference

object

The security preferences.

AccessKeyPreference

object

The AccessKey preferences.

AllowUserToManageAccessKeys

boolean

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

  • true: Allowed.

  • false: Not allowed.

false

AllowUserToManageServiceCredentials

boolean

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

  • true: Allowed.

  • false: Not allowed.

false

LoginProfilePreference

object

The login preferences.

EnableSaveMFATicket

boolean

Specifies whether to save the multi-factor authentication (MFA) status for 7 days after a RAM user passes MFA. Valid values:

  • true: Allowed.

  • false: Not allowed.

false

LoginSessionDuration

integer

The login session duration for RAM users, in hours.

6

LoginNetworkMasks

string

The login network mask.

10.0.0.0/8

AllowUserToChangePassword

boolean

Specifies whether RAM users can manage their own passwords. Valid values:

  • true: Allowed.

  • false: Not allowed.

true

OperationForRiskLogin deprecated

string

Specifies whether to require multi-factor authentication (MFA) for secondary authentication during a risky logon. Valid values:

  • autonomous (default): Secondary authentication is optional, and MFA device binding is not enforced.

  • enforceVerify: Secondary authentication is enforced.

autonomous

MFAOperationForLogin

string

Specifies whether MFA is required for logon. This parameter replaces EnforceMFAForLogin. Although EnforceMFAForLogin is still supported, using this new parameter is recommended. Valid values:

  • mandatory: MFA is required for all RAM users. This value corresponds to true for the EnforceMFAForLogin parameter.

  • independent (default): The MFA setting for each RAM user is applied independently. This value corresponds to false for the EnforceMFAForLogin parameter.

  • adaptive: MFA is required only for risky logons.

adaptive

AllowUserToLoginWithPasskey

boolean

Specifies whether RAM users can log in with passkeys. Valid values:

  • true: Allowed.

  • false: Not allowed.

true

MFAPreference

object

The MFA preferences.

AllowUserToManageMFADevices

boolean

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

  • true: Allowed.

  • false: Not allowed.

false

VerificationPreference

object

The preferences for MFA methods.

VerificationTypes

array

The MFA methods.

string

The MFA method. Valid values:

  • sms: SMS verification.

  • email: Email verification.

["sms","email"]

PersonalInfoPreference

object

The personal information preferences.

AllowUserToManagePersonalDingTalk

boolean

Specifies whether RAM users can bind or unbind their personal DingTalk accounts. Valid values:

  • true: Allowed.

  • false: Not allowed.

true

MaxIdleDays

object

The settings for the maximum idle period, in days.

MaxIdleDaysForUsers

integer

The maximum idle period (in days) for RAM users. If a RAM user with console login enabled remains inactive (does not log in, excluding SSO logins) for this period, their console login access is automatically disabled on the following day. The default value is 730.

730

MaxIdleDaysForAccessKeys

integer

The maximum idle period, in days, for a RAM user's AccessKey. If an AccessKey remains unused for this period, it is automatically disabled on the following day. The default value is 730.

730

RequestId

string

The request ID.

30C9068D-FBAA-4998-9986-8A562FED0BC3

Examples

Success response

JSON format

{
  "SecurityPreference": {
    "AccessKeyPreference": {
      "AllowUserToManageAccessKeys": false,
      "AllowUserToManageServiceCredentials": false
    },
    "LoginProfilePreference": {
      "EnableSaveMFATicket": false,
      "LoginSessionDuration": 6,
      "LoginNetworkMasks": "10.0.0.0/8",
      "AllowUserToChangePassword": true,
      "OperationForRiskLogin": "autonomous",
      "MFAOperationForLogin": "adaptive",
      "AllowUserToLoginWithPasskey": true
    },
    "MFAPreference": {
      "AllowUserToManageMFADevices": false
    },
    "VerificationPreference": {
      "VerificationTypes": [
        "[\"sms\",\"email\"]"
      ]
    },
    "PersonalInfoPreference": {
      "AllowUserToManagePersonalDingTalk": true
    },
    "MaxIdleDays": {
      "MaxIdleDaysForUsers": 730,
      "MaxIdleDaysForAccessKeys": 730
    }
  },
  "RequestId": "30C9068D-FBAA-4998-9986-8A562FED0BC3"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.