Technical Tip: Saving an Access Token as an Environment Variable for use in scripts
| Description | This article describes how to save an Access Token as an Environment Variable for use in scripts. |
| Scope | FortiDLP. |
| Solution | An access Token must be included to authenticate API requests to the Reveal infrastructure. it is recommended to save access tokens as environment variables, so it is not exposed in scripts or terminal sessions.
Generating an Access Token:
Saving the Token as an Environment Variable via PowerShell: The command below can be used, replacing <variable-name> with the name chosen, and <access-token> replaced by the Token generated on the web UI:
$Env:<variable-name> = "<access-token>"
Saving a Token as an Environment Variable via GUI:
Accessing the Environment Variable in PowerShell. The environment variable can now accessed in PowerShell using this syntax:
$Env:EXAMPLE_ACCESS_TOKEN
Response:
eyJxxxxx.v1.xxxxx
Related document: |




