For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Use secrets in your current shell

devo secret run gives secrets to one command. When you need them for several commands in a row, in the same Bash or PowerShell session, use devo secret shell enter. It sets environment variables in your current shell, and devo secret shell leave puts them back the way they were.

How it works

A program can't change the environment of the shell that started it. So devo secret shell enter doesn't set anything itself: it prints a short script for your shell, with the values in it, and you run that script with eval (Bash) or Invoke-Expression (PowerShell). --shell says which kind of script to print: bash or pwsh.

Check the references first

--check runs a value-free read of each reference, without reading any secret and without printing a script. It confirms the syntax and, for a named reference or on a local profile, the vault and the entry, but not that the field can be read: on Devolutions Cloud and Devolutions Server, a canonical reference isn't looked up. It needs JSON output:

devo secret shell enter --shell bash --env-ref DB_PASSWORD=<reference> --check --output json

Enter the scope

Repeat --env-ref NAME=<reference> for each variable. Run the script only if the command succeeded.

enter="$(devo secret shell enter --shell bash \
  --env-ref DB_USER=<username-reference> \
  --env-ref DB_PASSWORD=<password-reference>)" && eval "$enter"
unset enter
$enter = & devo secret shell enter --shell pwsh `
  --env-ref DB_USER=<username-reference> `
  --env-ref DB_PASSWORD=<password-reference> | Out-String
if ($LASTEXITCODE -eq 0) { Invoke-Expression $enter }
Remove-Variable enter

If a reference can't be read, the command prints nothing on its standard output, reports the error, and exits with a non-zero code: your shell stays unchanged.

See what's loaded

The status shows whether a scope is active, how many scopes are nested, and the names of the variables set by the most recent scope. It never shows values, and it needs JSON output.

Leave the scope

Leaving restores each variable as it was before you entered: its previous value if it had one, or no variable at all if it didn't.

Nest scopes

You can enter a scope while another one is active, for example to add a second set of credentials. Each devo secret shell leave closes the most recent scope only, so you leave in the reverse order you entered.

Good to know

  • The generated Bash script uses Bash features, so run it in Bash, not in another POSIX shell. For PowerShell, --shell powershell works the same as --shell pwsh.

  • Run devo secret shell status and devo secret shell leave with the same --shell value you used to enter.

  • devo secret shell enter doesn't read your environment or .env files: list each variable with --env-ref.

  • References resolve through the current context. Add --context <context-name> to use another workspace.

Next

Last updated

Was this helpful?