Account token
What is a token
The token connects your policy checks to your Centralized policy, which determines your available policies.
Additionally, the token allows Datree to report your policy check results to the dashboard.
Each token has the following properties:
- Label: the name of the token, as presented in the activity-log tab in your dashboard.
- Type: can be one of the following:
- read - allows using the policies in the dashboard, but forbids editing/creating them.
- write - allows using/editing/creating policies and tokens.
Tokens are immutable. To change one of the token's properties, a new token needs to be created and set in the CLI.
Connect your dashboard to your cluster
1. Get your account token from the dashboard
Log into your account
Go to "SETTINGS" (click on the avatar in the upper-right corner)
Copy your account token
2. Set your token in your cluster
To set your token, simply copy it and run the command specified here.
Setting your token in the CLI
To set your token when using the CLI, run the following command in your terminal (replace <token>
with your token):
datree config set token <token>
This will replace the token inside the config file (~/.datree/config.yaml
)
Token Management
Creating new tokens
A single account can have multiple tokens. Creating new tokens is done via the Token Management tab in your dashboard settings.
Policy checks executed with a certain token are reported only to the dashboard of that token's creator.
Using tokens in your CI
Setting your token in your CI is done using the DATREE_TOKEN
environment variable. The Datree CLI automatically checks this variable and uses its value as the token.
See our CI/CD section for examples using popular platforms.