Before you can use the Tanzu CLI for Tanzu Platform for Kubernetes, you must set the Tanzu CLI context and authenticate the Tanzu CLI context with Tanzu Platform hub. The steps in this topic set the Tanzu CLI context and authenticate to a specific organization in the hub.
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.
In Tanzu Platform hub, copy the organization ID:
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.
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.