Getting information about a service account
You can get information about a service account: its name and ID, creation and last authentication dates, and its roles in the folder.
-
In the management console
, navigate to the folder the service account belongs to. -
In the list of services, select Identity and Access Management.
-
In the left-hand panel, select
Service accounts. -
In the list that opens, select the service account you need.
-
The Overview page will list the service account's parameters:
- ID of the service account as a string in
aje9sb6ffd2u********
format. - Name.
- Date created.
- Date of last authentication.
- Roles in folder.
- ID of the service account as a string in
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder through 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 | DESCRIPTION |
+----------------------+------------------+-------------------------------+
| aje6o61dvog2******** | my-robot | |
| aje9sda1ufvq******** | account_name | account_description |
+----------------------+------------------+-------------------------------+
Get information about a service account using the get
command:
yc iam service-account get <service_account_ID>
Result:
id: aje6o61dvog2********
folder_id: jbmsjns93hj8********
created_at: "2024-09-09T20:15:19Z"
name: service-account
last_authenticated_at: "2024-09-19T18:05:06Z"
Where:
id
: Service account ID.folder_id
: Folder ID.created_at
: Service account creation date and time.name: service-account
: Service account name.last_authenticated_at
: Last authentication date and time.
-
Find out the ID of the folder where the service account was created.
-
Get information about the 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": "ajebqtreob2d********", "folderId": "b1gvmob95yys********", "createdAt": "2018-10-18T13:42:40Z", "name": "my-robot", "description": "my description" } ] }
You can also get information about the service accounts in the folder using the ServiceAccountService/List gRPC API call.