All Products
Search
Document Center

Bastionhost:ListUsers

Last Updated:Jul 17, 2026

Retrieves the list of users for a specified bastion host.

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

yundun-bastionhost:ListUsers

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID of the bastion host for which you want to query the user list.

Note

You can invoke the DescribeInstances operation to obtain this parameter.

bastionhost-cn-st220aw****

RegionId

string

No

The region ID of the bastion host for which you want to query the user list.

Note

For the mapping between region IDs and region names, see Regions and zones.

cn-hangzhou

PageNumber

string

No

The page number of the current page in a paging query. Default value: 1.

1

PageSize

string

No

The maximum number of entries per page in a paging query.
The maximum value of the PageSize parameter is 100. The default number of entries per page is 20. If PageSize is left empty, 20 entries are returned by default.

Note

Do not leave PageSize empty.

20

UserName

string

No

The logon name of the user that you want to query. Only exact match is supported.

abc

DisplayName

string

No

The display name of the user that you want to query. Only exact match is supported.

testuser

Source

string

No

The source of the user that you want to query. Valid values:

  • Local: local user

  • Ram: Resource Access Management (RAM) user

  • AD: AD user

  • LDAP: LDAP user

Local

Mobile

string

No

The mobile phone number of the user that you want to query. Only exact match is supported.

1359999****

UserState

string

No

The status of the user that you want to query. Valid values:

  • Normal: normal

  • Frozen: locked

  • Expired: expired

  • RemoteDeleted: user source deleted

  • Inactive: inactive due to prolonged absence of logon

  • PasswordExpired: password expired

  • RemoteDNChanged: user DN updated

  • RemoteFrozen: frozen on the RAM side

Normal

SourceUserId

string

No

The unique identity of the user that you want to query. Only exact match is supported.

Note

This parameter is the unique identity of the Resource Access Management (RAM) user that corresponds to the bastion host user. This parameter takes effect when the source of the newly created user is a RAM user (that is, Source is set to Ram). You can invoke the ListUsers operation of access control and obtain this parameter from the UserId field in the response.

122748924538****

UserGroupId

string

No

The ID of the user group that you want to query.

Note

You can call the ListUserGroups operation to obtain this parameter.

1

When you call this operation, you must include the common request parameters of Alibaba Cloud APIs in addition to the request parameters described in this topic. For more information about common request parameters, see Common parameters. For the request format of this operation, see the request examples in this topic.

Response elements

Element

Type

Description

Example

object

The response data.

TotalCount

integer

The total number of users returned.

1

RequestId

string

The request ID.

EC9BF0F4-8983-491A-BC8C-1B4DD94976DE

Users

array<object>

The list of users returned.

object

DisplayName

string

The display name of the user.

Bob

Email

string

The email address of the user.

1099**@qq.com

Comment

string

The remarks of the user.

comment

MobileCountryCode

string

The country code of the mobile phone number of the user. Valid values:

  • CN: the Chinese mainland (+86)

  • HK: Hong Kong (China) (+852)

  • MO: Macao (China) (+853)

  • TW: Taiwan (China) (+886)

  • RU: Russia (+7)

  • SG: Singapore (+65)

  • MY: Malaysia (+60)

  • ID: Indonesia (+62)

  • DE: Germany (+49)

  • AU: Australia (+61)

  • US: United States (+1)

  • AE: Dubai (+971)

  • JP: Japan (+81)

  • GB: United Kingdom (+44)

  • IN: India (+91)

  • KR: South Korea (+82)

  • PH: Philippines (+63)

  • CH: Switzerland (+41)

  • SE: Sweden (+46)

CN

Mobile

string

The mobile phone number of the user.

1359999****

UserId

string

The user ID.

1

Source

string

The source of the user. Valid values:

  • Local: local user

  • Ram: Resource Access Management (RAM) user

  • AD: AD user

  • LDAP: LDAP user

Local

UserName

string

The logon name of the user.

abc_def

SourceUserId

string

The unique identity of the user.

Note

This parameter is the unique identity of the Resource Access Management (RAM) user that corresponds to the bastion host user. This parameter is returned when the user source is a RAM user (that is, Source is set to Ram). If the user source is a local user (that is, Source is set to Local), this parameter is empty.

122748924538****

UserState

array

The user status array.

string

The status of the user. Valid values:

  • Normal: normal

  • Frozen: locked

  • Expired: expired

["Normal"]

EffectiveStartTime

integer

The start time of the validity period of the user, in seconds (UNIX timestamp format).

1669630029

EffectiveEndTime

integer

The end time of the validity period of the user, in seconds (UNIX timestamp format).

1672502400

NeedResetPassword

boolean

Indicates whether the password must be reset upon next logon. Valid values:

  • true: The password must be reset.

  • false: The password does not need to be reset.

true

TwoFactorStatus

string

The two-factor authentication status of the user. Valid values:

  • Global: follows the global settings

  • Disable: two-factor authentication disabled

  • Enable: two-factor authentication enabled, follows individual user settings

Enable

TwoFactorMethods

array

The array of enabled two-factor authentication methods.

string

The array of enabled two-factor authentication methods. A maximum of one method is supported. Valid values:

  • sms: SMS

  • email: email

  • dingtalk: DingTalk

  • totp: OTP token

  • gmusbkey: Chinese cryptographic USB key

[ "sms" ]

LanguageStatus

string

The language setting for message notifications. Valid values:

  • Global: follows the global settings

  • Custom: custom

Custom

Language

string

The language for message notifications. This parameter is required when LanguageStatus is set to Custom. Valid values:

  • zh-cn: Simplified Chinese

  • en: English

en

Examples

Success response

JSON format

{
  "TotalCount": 1,
  "RequestId": "EC9BF0F4-8983-491A-BC8C-1B4DD94976DE",
  "Users": [
    {
      "DisplayName": "Bob",
      "Email": "1099**@qq.com",
      "Comment": "comment",
      "MobileCountryCode": "CN",
      "Mobile": "1359999****",
      "UserId": "1",
      "Source": "Local",
      "UserName": "abc_def",
      "SourceUserId": "122748924538****",
      "UserState": [
        "[\"Normal\"]"
      ],
      "EffectiveStartTime": 1669630029,
      "EffectiveEndTime": 1672502400,
      "NeedResetPassword": true,
      "TwoFactorStatus": "Enable",
      "TwoFactorMethods": [
        "[\n      \"sms\"\n]"
      ],
      "LanguageStatus": "Custom",
      "Language": "en"
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The argument is invalid. The argument is invalid.
500 InternalError An unknown error occurred. An unknown error occurred.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.