Getting started with the CLI
This guide explains how to install or upgrade the Veracode CLI, add your API credentials, and run a test to ensure the CLI is setup correctly.
Prerequisites
Before you can install and use the Veracode CLI, you must have:
-
One of the following operating systems:
- macOS (Intel, M1 or M2)
- Linux (Intel)
- Windows
-
A Veracode account with API credentials.
Install or upgrade the CLI
Select from the following installation options:
- PowerShell
- Chocolatey
- cURL
Install the CLI on Windows using a PowerShell script.
-
Run PowerShell as an Administrator.
-
To enable PowerShell to run signed scripts, run:
Set-ExecutionPolicy AllSigned -Scope Process -Force
-
Install the CLI:
To install the latest version, run:
$ProgressPreference = "silentlyContinue"; iex ((New-Object System.Net.WebClient).DownloadString('https://tools.veracode.com/veracode-cli/install.ps1'))
To install a specific version, run:
$scriptPath = ((new-object net.webclient).DownloadString('https://tools.veracode.com/veracode-cli/install.ps1')); Invoke-Command -ScriptBlock ([scriptblock]::Create($scriptPath)) -ArgumentList "[version]"
where,
[version]
is the CLI version number, such as2.7.2
.
Install the CLI on Windows using Chocolatey.
To install the latest version, run:
choco install veracode-cli
To install a specific version, run:
choco install veracode-cli --version=[version]
where, [version]
is the CLI version number, such as 1.10.1
.
To install the CLI on macOS or Linux, run:
curl -fsS https://tools.veracode.com/veracode-cli/install | sh
Add your credentials
You can configure your API credentials as environment variables or store them with the CLI. For local development environments, Veracode recommends that you store your credentials with the CLI.
Configure credentials as environment variables
Veracode recommends you use this option when integrating the CLI with CI\CD systems.
To set the VERACODE_API_KEY_ID
and VERACODE_API_KEY_SECRET
environment variables to your API credentials, run:
- Windows
- macOS or Linux
set VERACODE_API_KEY_ID=<your_API_ID>
set VERACODE_API_KEY_SECRET=<your_API_key>
export VERACODE_API_KEY_ID=<your_API_ID>
export VERACODE_API_KEY_SECRET=<your_API_key>
Store credentials with the CLI
Veracode recommends you use this option when running the CLI locally.
-
To configure the CLI, run:
- Windows
- macOS or Linux
veracode configure
./veracode configure
-
Enter your API ID and secret key. If you have set your credentials as environment variables, the CLI pre-populates these fields.
Test the installation
To run a test scan and confirm that you have successfully installed the CLI, run:
- Windows
- macOS or Linux
veracode scan --source alpine:latest --type image
./veracode scan --source alpine:latest --type image