Sign in from a CI pipeline
A pipeline can't open a browser or type a password. Devolutions CLI signs in with a key instead, and reads the secret part of that key from an environment variable or a file that your CI system protects. The secret is never written on the command line.
Pick the right sign-in method
Devolutions Cloud
Application key and application secret
--application-key with --application-secret-env or --application-secret-file
Devolutions Server
API key
--api-key-env or --api-key-file
Devolutions Server
Application user
--as-application with --username and --password-env or --password-file
Create the application key, API key, or application user in your workspace first, and give it access only to the vaults the pipeline needs. Then store its secret in your CI system's protected variables or secret files.
Sign in
devo login ci-cloud --cloud https://<your-organization>.devolutions.app \
--application-key <application-key> \
--application-secret-env DEVO_APP_SECRETDEVO_APP_SECRET is the name of the variable that holds the application secret. To read it from a file instead, use --application-secret-file <path>.
devo login ci-server --server https://<your-server-address> \
--api-key-env DEVO_API_KEYTo read the API key from a file instead, use --api-key-file <path>.
devo login ci-server --server https://<your-server-address> \
--as-application --username <application-user> \
--password-env DEVO_APP_PASSWORDTo read the secret from a file instead, use --password-file <path>.
The context you sign in to becomes the current one, so the next commands use it. Add --json to get a result you can check in a script. See Read results as JSON.
Keep the secret available for the whole job
Devolutions CLI doesn't copy the secret into its configuration. It saves where the secret is, the variable name or the file path, and reads it again every time it connects to your workspace, including from its background process. So:
Set the variable, or create the file, before the first
devocommand of the job.Keep it set, or keep the file in place, until the last
devocommand.If you rotate a secret kept in a file, replace the file's content: the next connection reads the new value, without a new sign-in.
If the variable or the file is missing later, commands fail with secretReferenceUnavailable.
Example: a generic CI job
This job signs in to Devolutions Cloud, runs a deployment script with a database password from the vault, and cleans up. Adapt the variable names to your CI system: most of them expose protected variables as environment variables.
To run the cleanup even when a step fails, put the last three commands in your CI system's "always run" step or in a shell trap. More about the configuration folder and the background process is in Install Devolutions CLI on build agents.
Sign in on a computer without a browser
On a server or a remote session where you are present but no browser can open, use the device code flow with --oauth --use-device-code. Devolutions CLI prints a web address and a code; open the address on any device and sign in. Setting the environment variable DEVO_CLI_USE_DEVICE_CODE to 1 has the same effect as --use-device-code. Either way, it applies only to a sign-in with --oauth.
This flow needs a person to complete it, so it doesn't fit an unattended pipeline.
If it doesn't work
The error says the variable or the file can't be found: check the name you passed (the variable name, without
$), and that the CI system exposes it to this step.Sign-in fails or the session expires: see Sign-in fails or the session expired.
All sign-in methods and options: Sign in to Devolutions Cloud, Sign in to Devolutions Server.
Next
Last updated
Was this helpful?