diff --git a/docs/cli/commands/tanzu.md b/docs/cli/commands/tanzu.md index cf0f2a641..2983df387 100644 --- a/docs/cli/commands/tanzu.md +++ b/docs/cli/commands/tanzu.md @@ -10,7 +10,7 @@ The Tanzu CLI ### SEE ALSO -* [tanzu api-token](tanzu_api-token.md) - API Token Generation for Tanzu Platform +* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform * [tanzu completion](tanzu_completion.md) - Output shell completion code * [tanzu config](tanzu_config.md) - Configuration for the CLI * [tanzu context](tanzu_context.md) - Configure and manage contexts for the Tanzu CLI diff --git a/docs/cli/commands/tanzu_api-token.md b/docs/cli/commands/tanzu_api-token.md index 1aafe0460..79e18982a 100644 --- a/docs/cli/commands/tanzu_api-token.md +++ b/docs/cli/commands/tanzu_api-token.md @@ -1,6 +1,6 @@ ## tanzu api-token -API Token Generation for Tanzu Platform +Manage API Tokens for Tanzu Platform ### Options @@ -11,5 +11,5 @@ API Token Generation for Tanzu Platform ### SEE ALSO * [tanzu](tanzu.md) - The Tanzu CLI -* [tanzu api-token create](tanzu_api-token_create.md) - Create new API Token +* [tanzu api-token create](tanzu_api-token_create.md) - Create a new API Token for Tanzu Platform diff --git a/docs/cli/commands/tanzu_api-token_create.md b/docs/cli/commands/tanzu_api-token_create.md index 106d8c175..45b76d346 100644 --- a/docs/cli/commands/tanzu_api-token_create.md +++ b/docs/cli/commands/tanzu_api-token_create.md @@ -1,11 +1,23 @@ ## tanzu api-token create -Create new API Token +Create a new API Token for Tanzu Platform ``` tanzu api-token create [flags] ``` +### Examples + +``` + + # Create an API Token for the Tanzu Platform + tanzu api-token create + + # Note: The retrieved token can be used as the value of TANZU_API_TOKEN + # when running 'tanzu login'. For example: + TANZU_API_TOKEN= tanzu login +``` + ### Options ``` @@ -14,5 +26,5 @@ tanzu api-token create [flags] ### SEE ALSO -* [tanzu api-token](tanzu_api-token.md) - API Token Generation for Tanzu Platform +* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform diff --git a/docs/quickstart/quickstart.md b/docs/quickstart/quickstart.md index 3bd3a2032..b40384f3f 100644 --- a/docs/quickstart/quickstart.md +++ b/docs/quickstart/quickstart.md @@ -232,10 +232,19 @@ Notes: ##### API Token +To authenticate with the Tanzu Platform Endpoint for non-interactive login, you must first generate an API token. + +###### Generating an API Token + +- For public endpoints, generate the API token via the CSP UI at https://console.tanzu.broadcom.com. +- For Self-Managed use cases that rely on UAA, create the API token using the `tanzu api-token create` command. + +###### Logging in with an API Token + Example command to log in using an API token: ```console -TANZU_API_TOKEN= tanzu login +TANZU_API_TOKEN= tanzu login [--endpoint ] ``` Users can persist the environment variable in the CLI configuration file, which will be used for each CLI command @@ -243,7 +252,7 @@ invocation: ```console tanzu config set env.TANZU_API_TOKEN -tanzu login +tanzu login [--endpoint ] ``` ### Creating and connecting to a new context @@ -298,6 +307,15 @@ Notes: ##### API Token +To authenticate with the Tanzu Platform Endpoint for non-interactive login, you must first generate an API token. + +###### Generating an API Token + +- For public endpoints, generate the API token via the CSP UI at https://console.tanzu.broadcom.com. +- For Self-Managed use cases that rely on UAA, create the API token using the `tanzu api-token create` command. + +###### Logging in with an API Token + Example command for creating a tanzu context using an API token: ```console diff --git a/pkg/command/apitoken.go b/pkg/command/apitoken.go index f10b2417a..829917311 100644 --- a/pkg/command/apitoken.go +++ b/pkg/command/apitoken.go @@ -23,7 +23,7 @@ import ( func newAPITokenCmd() *cobra.Command { apiTokenCmd := &cobra.Command{ Use: "api-token", - Short: "API Token Generation for Tanzu Platform", + Short: "Manage API Tokens for Tanzu Platform", Aliases: []string{"apitoken"}, Annotations: map[string]string{ "group": string(plugin.SystemCmdGroup), @@ -41,9 +41,16 @@ func newAPITokenCmd() *cobra.Command { func newAPITokenCreateCmd() *cobra.Command { createCmd := &cobra.Command{ Use: "create", - Short: "Create new API Token", + Short: "Create a new API Token for Tanzu Platform", Aliases: []string{}, - RunE: createAPIToken, + Example: ` + # Create an API Token for the Tanzu Platform + tanzu api-token create + + # Note: The retrieved token can be used as the value of TANZU_API_TOKEN + # when running 'tanzu login'. For example: + TANZU_API_TOKEN= tanzu login`, + RunE: createAPIToken, } return createCmd