Skip to content

Commit 220539a

Browse files
committed
DOCS-3295: Add profiles
1 parent 1f1f1b1 commit 220539a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

docs/dev/tools/cli.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ to later update the Viam CLI tool on macOS, run `brew upgrade viam`.
107107

108108
Once you have [installed the Viam CLI](#install), you must authenticate your CLI session with Viam in order to run CLI commands.
109109

110-
You can authenticate your CLI session using either a personal access token, or an organization, location, or machine part API key.
110+
You can authenticate your CLI session using a personal access token, a profile, or an organization, location, or machine part API key.
111111

112112
- To authenticate your CLI session using a personal access token:
113113

@@ -133,6 +133,19 @@ An authenticated session is valid for 24 hours, unless you explicitly [log out](
133133

134134
After the session expires or you log out, you must re-authenticate to use the CLI again.
135135

136+
- To authenticate using a profile:
137+
138+
## CLI profiles
139+
140+
You can also authenticate your CLI session with profiles which allow you to switch between using different privileges.
141+
142+
```sh {class="command-line" data-prompt="$" data-output="2-10"}
143+
viam profiles add --profile-name=default --key-id=<api-key-id> --key=<api-key>
144+
```
145+
146+
To specify a profile for a command use the `--profile` flag.
147+
To set a profile for a shell session, set the environment variable `VIAM_CLI_PROFILE_NAME` to your profile name.
148+
136149
### Create an organization API key
137150

138151
To use an API key to authenticate your CLI session, you must create one.
@@ -1626,8 +1639,8 @@ You can pass global options after the `viam` CLI keyword with any command.
16261639
<!-- prettier-ignore -->
16271640
| Global option | Description |
16281641
| ------------- | ----------- |
1629-
| `--debug` | Enable debug logging (default: false). |
1630-
| `--disable-profiles`, `disable-profile` | Disable usage of [profiles](#profiles), falling back to default (false) behavior. |
1631-
| `--help`, `-h` | Show help (default: false). |
1642+
| `--debug` | Enable debug logging. Default: `false`. |
1643+
| `--disable-profiles`, `disable-profile` | Disable usage of [profiles](#profiles), falling back to default (false) behavior. Default: `false`. |
1644+
| `--help`, `-h` | Show help. Default: `false`. |
16321645
| `--profile` | Specify a particular [profile](#profiles) for the current command. |
1633-
| `--quiet`, `-q` | Suppress warnings (default: false). |
1646+
| `--quiet`, `-q` | Suppress warnings. Default: `false` |

0 commit comments

Comments
 (0)