Skip to main content
To authenticate as a service account and perform operations on its behalf, use an authorized key pair.

Prerequisites

  1. Make sure that you, or the service account that you use on your behalf, is in a group that has the admin role within your tenant; for example, the default admins group. You can check this in the Administration → IAM section of the web console.
  2. Create a new service account if needed.

Creating a key pair

If you are using the CLI, this step is optional. If you use the nebius iam auth-public-key generate command in the next step, the CLI creates the key pair for you.
Create a key pair on your local machine:
This command creates the public.pem and private.pem key files in your local directory where you run the command.

Uploading the public key

To upload an authorized key with Terraform or one of the SDKs, the provider or SDK must already be authenticated with an existing authorized key. You cannot upload the first authorized key for a service account using Terraform or an SDK. If you already have an authorized key, for example, one created with the CLI, proceed to update the configuration to use your existing authorized key with Terraform or the SDK.
  1. In the web console, go to AdministrationIAM.
  2. Open the Service accounts tab.
  3. Open the page of the required service account.
  4. Click Upload authorized key.
  5. Click Attach file and then select public.pem.
  6. (Optional) Set an expiration date.
  7. Click Upload key.
The key is displayed on the Authorized keys tab.

Updating the configuration

Update your configuration to use the authorized key you created:
If you used the web console to upload the public key, you do not need to update any additional configuration.
Create a new CLI profile:
  1. Get the ID of the project that you want to work in and save it to an environment variable:
  2. Initialize the Nebius AI Cloud CLI configuration:
  3. Check that your new profile has been created and set as default:
Now you can run Nebius AI Cloud CLI commands on behalf of the service account. To do this, add --profile <service_account_profile_name> to the commands.