Tanzu Platform 10.0

Set the Tanzu CLI context to an organization

Last Updated March 03, 2025

Before you can use the Tanzu CLI to manage Kubernetes Spaces, you must set the Tanzu CLI context and authenticate the Tanzu CLI context with Tanzu Platform. The steps in this topic set the Tanzu CLI context and authenticate to a specific organization in Tanzu Platform.

By default, the tanzu login command creates a CSP token from your CSP Default Organization. To create a token for an organization other than your default CSP organization, you must export the org ID as described in the following steps. If you do not export the org ID, the token for your context is set for your default organization.

  1. In the Tanzu Platform UI, copy the organization ID:

    1. Log in to the Tanzu Platform UI.
    2. In the upper-right corner, click your user name.
    3. Click Change Organization, and then in the drop-down menu hover the pointer over the organization.
    4. Copy the value for Long ID from the display box.
  2. Export the organization ID by running:

    export TANZU_CLI_CLOUD_SERVICES_ORGANIZATION_ID=<org-id>
    

    Where <org-id> is the organization ID you copied in step 1.

  3. Log in with the Tanzu CLI by running:

    tanzu login
    

After the command runs, you are redirected to a browser window to authenticate. After authentication is successful, the following message appears:

You have successfully logged in! You can safely close this window

A similar message also displays in the command output.

For more information about the tanzu login command and how to manage Tanzu CLI contexts, see Create and manage CLI contexts.