Before you can use the Tanzu CLI, you must set the Tanzu CLI context and authenticate the Tanzu CLI context with Tanzu Platform hub. The following steps set the Tanzu CLI context and authenticate to a specific organization in the hub.
NoteBy 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.
In Tanzu Platform hub, copy the organization ID.
Run the following command to export the organization ID:
export TANZU_CLI_CLOUD_SERVICES_ORGANIZATION_ID=<org-id>
Where:
<org-id>
is the organization ID you copied in step 1.
Log in with the tanzu
CLI:
tanzu login
After the command runs, you are redirected to a browser window to authenticate. After authentication is successful, you see the following message:
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
and how to manage Tanzu CLI contexts, see Create and manage CLI contexts.