From 6f66b3e38fbfd526c955bec9ff178e0ddbed9de8 Mon Sep 17 00:00:00 2001 From: Naomi Pentrel <5212232+npentrel@users.noreply.github.com> Date: Mon, 19 May 2025 15:56:54 +0200 Subject: [PATCH] DOCS-3295: Add profiles --- docs/dev/tools/cli.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/dev/tools/cli.md b/docs/dev/tools/cli.md index fe4a50ed3a..acd6579d91 100644 --- a/docs/dev/tools/cli.md +++ b/docs/dev/tools/cli.md @@ -107,7 +107,7 @@ to later update the Viam CLI tool on macOS, run `brew upgrade viam`. Once you have [installed the Viam CLI](#install), you must authenticate your CLI session with Viam in order to run CLI commands. -You can authenticate your CLI session using either a personal access token, or an organization, location, or machine part API key. +You can authenticate your CLI session using a personal access token, a profile, or an organization, location, or machine part API key. - To authenticate your CLI session using a personal access token: @@ -133,6 +133,19 @@ An authenticated session is valid for 24 hours, unless you explicitly [log out]( After the session expires or you log out, you must re-authenticate to use the CLI again. +- To authenticate using a profile: + +## CLI profiles + +You can also authenticate your CLI session with profiles which allow you to switch between using different privileges. + +```sh {class="command-line" data-prompt="$" data-output="2-10"} +viam profiles add --profile-name=default --key-id= --key= +``` + +To specify a profile for a command use the `--profile` flag. +To set a profile for a shell session, set the environment variable `VIAM_CLI_PROFILE_NAME` to your profile name. + ### Create an organization API key To use an API key to authenticate your CLI session, you must create one. @@ -1460,8 +1473,8 @@ You can pass global options after the `viam` CLI keyword with any command. | Global option | Description | | ------------- | ----------- | -| `--debug` | Enable debug logging (default: false). | -| `--disable-profiles`, `disable-profile` | Disable usage of [profiles](#profiles), falling back to default (false) behavior. | -| `--help`, `-h` | Show help (default: false). | +| `--debug` | Enable debug logging. Default: `false`. | +| `--disable-profiles`, `disable-profile` | Disable usage of [profiles](#profiles), falling back to default (false) behavior. Default: `false`. | +| `--help`, `-h` | Show help. Default: `false`. | | `--profile` | Specify a particular [profile](#profiles) for the current command. | -| `--quiet`, `-q` | Suppress warnings (default: false). | +| `--quiet`, `-q` | Suppress warnings. Default: `false` |