viewer role, you can read resources but not create or modify them, even if you are an administrator.
Impersonation is useful when you want to:
- Run commands or Terraform configurations as a service account without storing its credentials.
- Check which operations a service account can perform with its current group memberships.
Prerequisites
- CLI
- Terraform
- Install and configure the Nebius AI Cloud CLI.
- Create a service account if you haven’t already.
- Add the service account to a group that grants it the required permissions.
How to impersonate a service account
- CLI
- Terraform
To run a Nebius AI Cloud CLI command as the service account, add the To check that impersonation works:For more information about access tokens, see Access tokens in Nebius AI Cloud.
--impersonate-service-account-id (or -I as a short version) parameter to the command. You can add it to any command.To run all commands of a CLI profile as the service account, add the impersonate-service-account-id key to the profile in the ~/.nebius/config.yaml file:-
List service accounts in your project and copy the ID of the service account (
metadata.id) to impersonate: -
Check that the command uses the identity of the service account:
In this command,
<service_account_ID>is themetadata.idvalue that you copied in the previous step. Theservice_account_profile.info.metadata.idin the output should match the ID of the service account.