Getting a list of the folder's service accounts
You can get a list of all service accounts available in the folder.
- In the management console
, navigate to the folder whose list of service accounts you want to get. - In the list of services, select Identity and Access Management.
- In the left-hand panel, select
Service accounts. - The Service accounts page will display a list of all the folder's service accounts.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID>
command. You can also set a different folder for any specific command using the --folder-name
or --folder-id
parameter.
Get a list of service accounts in the default folder:
yc iam service-account list
Result:
+----------------------+--------------+--------+---------------------+-----------------------+
| ID | NAME | LABELS | CREATED AT | LAST AUTHENTICATED AT |
+----------------------+--------------+--------+---------------------+-----------------------+
| ajeg2b2et02f******** | my-robot | | 2024-09-08 18:59:45 | 2025-02-18 10:10:00 |
| ajegtlf2q28a******** | account-name | | 2023-06-27 16:18:18 | 2025-02-18 10:20:00 |
+----------------------+--------------+--------+---------------------+-----------------------+
Where:
ID
: Service account ID.NAME
: Service account name.LABELS
: Service account description.CREATED AT
: Service account creation date and time.LAST AUTHENTICATED AT
: Last authentication date and time.
-
Find out the ID of the folder whose list of service accounts you want to view.
-
Get a list of service accounts in the folder using the list REST API method for the ServiceAccount resource:
export FOLDER_ID=b1gvmob95yys******** export IAM_TOKEN=CggaATEVAgA... curl \ --header "Authorization: Bearer ${IAM_TOKEN}" \ "https://iam.api.cloud.yandex.net/iam/v1/serviceAccounts?folderId=${FOLDER_ID}"
Result:
{ "serviceAccounts": [ { "id": "ajeg2b2et02f********", "folderId": "b1gvmob95yys********", "createdAt": "2024-09-08T18:59:45Z", "name": "my-robot", "lastAuthenticatedAt": "2025-02-18T10:10:00Z" }, { "id": "ajegtlf2q28a********", "folderId": "b1gvmob95yys********", "createdAt": "2023-06-27T16:18:18Z", "name": "account-name", "lastAuthenticatedAt": "2025-02-18T10:20:00Z" } ] }
You can also get a list of service accounts in a folder using the ServiceAccountService/List gRPC API call.