> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to work with the Nebius AI Cloud CLI on a Compute virtual machine

On a Compute virtual machine, you cannot log into the Nebius AI Cloud CLI with your user account, because it requires opening the web console in a browser. However, you can still use the Nebius AI Cloud CLI with a service account, in one of two ways:

* [Specify the service account on VM creation](#specify-the-service-account-on-vm-creation)
* [Set up a profile for the service account on the VM](#set-up-a-profile-for-the-service-account-on-the-vm)

## Prerequisites

[Create a service account](../iam/service-accounts/manage#create-a-service-account) and [add it to a group](../iam/authorization/groups/members#add-a-service-account) that has the [roles](../iam/authorization/roles) needed for your operations. Usually, this means adding it to at least the default `editors` group.

You do not need to install the Nebius AI Cloud CLI. It is preinstalled on every Compute VM.

## Specify the service account on VM creation

When you [create a VM](../compute/virtual-machines/manage#create-a-vm), specify the service account ID in the VM specifications:

<Tabs group="interfaces">
  <Tab title="CLI">
    Add the `--service-account-id` parameter to the creation command:

    ```bash theme={null}
    nebius compute instance create \
      "$(cat /path-to-spec/instance.yaml)" \
      --service-account-id <service_account_ID>
    ```

    Alternatively, add the `service_account_id` parameter to the VM specification:

    ```yaml theme={null}
    ...
    spec:
      ...
      service_account_id: <service_account_ID>
    ```
  </Tab>

  <Tab title="Terraform">
    Add the `service_account_id` parameter to the `nebius_compute_v1_instance` block in the configuration:

    ```hcl theme={null}
    resource "nebius_compute_v1_instance" "<VM_name>" {
      service_account_id = "<service_account_ID>"
      ...
    }
    ```
  </Tab>
</Tabs>

Once the VM is ready, you can connect to it and use the Nebius AI Cloud CLI without any additional setup. The authorization token is automatically fetched from `/mnt/cloud-metadata/token`.

## Set up a profile for the service account on the VM

If you haven't specified a service account during VM creation, you can configure a Nebius AI Cloud CLI profile for that service account:

1. Create an [authorized key](../iam/service-accounts/authorized-keys) for the service account.
2. Create a profile for the service account on your VM. Follow the instructions in [How to set up the Nebius AI Cloud CLI](./configure).

After that, you can use the Nebius AI Cloud CLI.
