> ## 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 set up the Nebius AI Cloud CLI

To configure the Nebius AI Cloud CLI, use one of the authorization options:

* [A user account](#authorize-with-a-user-account) offers personalized access and accountability. It can be used when you, as a human user, need to manage and interact with resources.
* [A service account](#authorize-with-a-service-account) automates the interaction of applications and services with resources.

## Authorize with a user account

To authorize quickly, follow the non-interactive flow. To control the authorization process, follow the interactive flow.

<Tabs>
  <Tab title="Non-interactive flow">
    1. Open your terminal.

    2. Create a name of your new profile in the Nebius AI Cloud CLI and save it to an environment variable:

       ```bash theme={null}
       export NB_PROFILE_NAME=<new-profile-name>
       ```

    3. [Get the project ID](/iam/manage-projects#cli-3) and save it to an environment variable:

       ```bash theme={null}
       export NB_PROJECT_ID=<project_ID>
       ```

    4. Run the following command:

       ```sh theme={null}
       nebius profile create \
         --profile $NB_PROFILE_NAME \
         --endpoint api.nebius.cloud \
         --federation-endpoint auth.nebius.com \
         --parent-id $NB_PROJECT_ID
       ```

       If you have access to multiple tenants, you can specify the tenant that you want to use with this profile in the `--tenant-id` parameter.

       If you are added to someone else's [tenant](../iam/overview#tenants) and know the ID of its [federation](../iam/overview#federations), you can specify it either in the `--federation-id` parameter, or when logging in to the Nebius AI Cloud web console after running the command.

    5. In the browser tab that opens, log in to the web console if prompted. After logging in (or if you have already been logged in), you will see the following message:

       ```plaintext theme={null}
       Login is successful, you may close the browser tab and go to the console
       ```

    6. Close the browser tab and go back to your terminal window. You will see the following message:

       ```plaintext theme={null}
       Profile "<profile-name>" configured and activated
       ```

    7. Verify that your new profile has been created and set as the default:

       ```bash theme={null}
       nebius profile list
       ```

       You should see the following output:

       ```sh theme={null}
       default
       <profile-name> [default]
       ```
  </Tab>

  <Tab title="Interactive flow">
    1. Open your terminal.

    2. Run the following command:

       ```sh theme={null}
       nebius profile create
       ```

    3. Set up the new profile:

       1. Using arrow keys, select **Create a new profile** and press `Enter`.

       2. Specify the profile name and press `Enter`.

       3. Keep the default value for **Select api endpoint** (`api.nebius.cloud`) and press `Enter`.

       4. Under **Select authorization type**, keep `federation` and press `Enter`.

       5. Keep the default value for **Select federation endpoint** (`auth.nebius.com`) and press `Enter`.

       6. In the browser tab that opens, log into the Nebius AI Cloud web console if prompted. After logging in (or if you have already been logged in), you will see the following message:

          ```plaintext theme={null}
          Login is successful, you may close the browser tab and go to the console
          ```

       7. Close the browser tab and go back to your terminal window. If you have access to multiple tenants, the CLI will prompt you to choose a tenant ID. Choose the tenant that you want to use. If you only have access to one tenant, it is selected by default. You will see the following message:

          ```plaintext theme={null}
          Profile "<profile-name>" configured and activated
          ```

    4. Verify that your new profile has been created and set as the default:

       ```bash theme={null}
       nebius profile list
       ```

       You should see the following output:

       ```sh theme={null}
       default
       <profile-name> [default]
       ```

    5. [Get the project ID](/iam/manage-projects#cli-3) and add it to the CLI configuration:

       ```bash theme={null}
       nebius config set parent-id <project_ID>
       ```
  </Tab>
</Tabs>

## Authorize with a service account

Before authorization, [create a service account](../iam/service-accounts/manage). You can do it using a user account or another service account within a [group](../iam/authorization/groups) that has the `admin` role within your tenant; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

To authorize quickly, follow the non-interactive flow. To control the authorization process, follow the interactive flow.

<Tabs>
  <Tab title="Non-interactive flow">
    1. Open the service account page in the web console and view the service account details. You'll need to view the service account's details from there.

    2. Open your terminal.

    3. Open the service account page in the web console.

    4. Save the service account details to environment variables:

       ```bash theme={null}
       export SA_ID=<service-account-id>
       export PUBLIC_KEY_ID=<...>
       export PRIVATE_KEY_PATH=<...>
       ```

    5. Create a name for your profile and save it to an environment variable:

       ```bash theme={null}
       export SA_PROFILE_NAME=<...>
       ```

       For example, `gpu-monitoring-sa`.

           <Warning>
             **Use one profile per project**

             Create a separate Nebius AI Cloud CLI profile for each project to ensure correct [region](/overview/regions)-specific configuration.
           </Warning>

    6. [Get the project ID](/iam/manage-projects#cli-3) and save it to an environment variable:

       ```bash theme={null}
       export NB_PROJECT_ID=<project_ID>
       ```

    7. Run the following command:

       ```bash theme={null}
       nebius profile create \
         --endpoint api.nebius.cloud \
         --service-account-id $SA_ID \
         --public-key-id $PUBLIC_KEY_ID \
         --private-key-file $PRIVATE_KEY_PATH \
         --profile $SA_PROFILE_NAME \
         --parent-id $NB_PROJECT_ID
       ```

       You will see the following message:

       ```plaintext theme={null}
       Profile "<profile-name>" configured and activated
       ```

    8. Check that your new profile has been created and set as the default one:

       ```bash theme={null}
       nebius profile list
       ```

       You should see the following output:

       ```sh theme={null}
       default
       <profile-name> [default]
       ```
  </Tab>

  <Tab title="Interactive flow">
    1. Open the service account page in the web console and view the service account details. You'll need to view the service account's details from there.

    2. Open your terminal.

    3. Run the following command:

       ```sh theme={null}
       nebius profile create
       ```

    4. Use the arrow keys to select **Create a new profile**, then click `Enter`.

           <Warning>
             **Use one profile per project**

             Create a separate Nebius AI Cloud CLI profile for each project to ensure correct [region](/overview/regions)-specific configuration.
           </Warning>

    5. Add a profile name and click `Enter`.

    6. Keep the default value for **Select api endpoint** (api.nebius.cloud) and click `Enter`.

    7. Under **Select authorization type**, choose `service account` and click `Enter`.

    8. Under **Set service account ID**, paste the **Service account ID** from the web console.

    9. Under **Set public key ID**, paste the **Public key ID** from the web console.

    10. Under **Set path to PEM encoded private key**, specify the path to your private key in PEM format.

        You will see the following message:

        ```plaintext theme={null}
        Profile "<profile-name>" configured and activated
        ```

    11. Check that your new profile has been created and set the default one:

        ```bash theme={null}
        nebius profile list
        ```

        You should see the following output:

        ```sh theme={null}
        default
        <profile-name> [default]
        ```

    12. [Get the project ID](/iam/manage-projects#cli-3) and add it to the CLI configuration.

        ```bash theme={null}
        nebius config set parent-id <project_ID>
        ```
  </Tab>
</Tabs>
