Run a command with its secrets
devo secret run is the safest way to give a secret to a program. Devolutions CLI reads the values from your vault, puts them in the environment of that one program, starts it, and hides the values in everything it prints. Your shell never holds the value, and nothing is written to disk.
devo secret run --env-ref DB_PASSWORD=<reference> -- <your-command> <arguments>Everything after -- is the program and its arguments. To find <reference>, see Find the reference to a secret.
Pick the right way to pass references
--env-ref NAME=<reference>
Sets the environment variable NAME to the value. Repeat the option for each secret.
You launch a command by hand or from a script.
A variable that already holds a reference
Any environment variable of your shell whose value is a devo:// reference is replaced by the value for the program.
Your shell profile or CI pipeline already sets variables such as DB_PASSWORD=devo://….
--env-file <file>
Reads KEY=value lines and resolves the references they contain.
Your project already has a .env file. See Take the passwords out of a .env file.
--stdin-reference <reference>
Writes the value, exactly, to the standard input of the program, then closes it.
The program reads a password from standard input, like docker login --password-stdin.
--manifest <file>
Reads the command, its arguments, and its references from a JSON file.
You want one launch file to review and reuse, for example for an AI agent.
Pass several secrets
Repeat --env-ref for each variable. Names use letters, digits, and underscores, and can't start with a digit.
devo secret run \
--env-ref DB_USER=<username-reference> \
--env-ref DB_PASSWORD=<password-reference> \
-- ./migrate.shdevo secret run `
--env-ref DB_USER=<username-reference> `
--env-ref DB_PASSWORD=<password-reference> `
-- pwsh -NoProfile -File ./migrate.ps1The program receives the rest of your environment as usual. Each variable name can be defined only once across all sources: if the same name comes from --env-ref and from a variable of your shell that holds a reference, the command stops with a conflict instead of choosing for you.
Use the references already in your environment
If a variable of your current shell holds a devo:// reference, devo secret run resolves it for the program without any option:
The variable in your shell keeps the reference. Only the program sees the value. This doesn't apply with --manifest, where the manifest lists every reference: with a manifest, such a variable reaches the program as the plain reference text, not the value.
Send a secret to standard input
Devolutions CLI writes the value with no trailing newline, then closes the standard input of the program.
Keep references out of the command line
Devolutions CLI refuses an argument of the program that is a reference, like -- psql --password devo://…. References are resolved only through --env-ref, --stdin-reference, an environment file, or a manifest. A reference inside a longer argument, like --password=devo://…, isn't refused but isn't resolved either: the program receives the reference text.
Check before you run
Two options let you test a launch without starting the program:
--dry-run
Builds the launch plan and shows a summary: the command, the number of references, the timeout, and whether masking is on. With --output json, the plan lists each variable with its reference. It doesn't contact your workspace and doesn't look for the program.
--check
Also makes sure the program exists in the current folder or on your PATH, and runs a value-free read of each reference. That confirms the syntax and, for a named reference or on a local profile, the vault and the entry. It doesn't prove the field can be read: on Devolutions Cloud and Devolutions Server, a canonical reference isn't looked up. References from an environment file are checked as written, before ${NAME} is replaced.
You can use one or the other, not both. Both accept --output json.
Limit how long the program runs
When the time is up, Devolutions CLI stops the program and everything it started, and exits with code 124. If you cancel with Ctrl+C, it stops the program and exits with 130. Otherwise, devo secret run exits with the exit code of your program.
Keep a record of the launch
Add --receipt-file <path> to write a JSON receipt after the program ends: the launch plan, the variable names, the exit code, the duration, and whether the program timed out or was cancelled. The receipt contains no secret value. The file must not exist yet. Devolutions CLI creates it with private permissions: on macOS and Linux, only your user account can read it; on Windows, your account, the system account, and administrators.
Use a launch manifest
A manifest is a JSON file that describes the whole launch. With --manifest, you can't add --env-ref, --env-file, --stdin-reference, --timeout-seconds, or a command after --.
commandis required.schemaVersionis optional; if you set it, it must be1. The other properties are optional.Each value in
environmentmust be a singledevo://reference.workingDirectorymust be an absolute path to a folder that exists.A property or a variable name can't appear twice.
About masking
Devolutions CLI watches what the program prints on its standard output and standard error, and replaces each resolved value with <concealed by Devolutions>. If a tool needs to print a value, for example to pipe it to another program, add --no-masking.
Good to know
References resolve through the current context. Add
--context <context-name>to use another workspace for one command. Canonical references always resolve against the workspace that owns them.An invalid launch, such as a malformed
--env-ref, exits with code2before anything is read. See Exit codes and errors.A reference that doesn't resolve stops the launch before the program starts. See A secret reference doesn't resolve.
Next
Every option of
devo secret run: Commands
Last updated
Was this helpful?