Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSTS secrets as environment variables

In the VSTS build, I set various variables (Edit build -> Variables tab), some I set as secret (click the lock), some I don't.

In the build, I run a command prompt task to run set -- e.g. show me all the environment variables. Those marked as secret aren't present.

How do I get VSTS secrets into environment variables?

like image 248
robrich Avatar asked May 01 '18 01:05

robrich


People also ask

Should Secrets be in environment variables?

Secrets are environment variables with extra security measures to protect their values. Any environment variables that define sensitive or private information (such as credentials) should be stored as secrets. A secret may be defined as a secure variable for any number of services in the environment.

How do I check environment variables on Azure DevOps?

There are 3 ways to get an environment variable value on your build server: Set the value on the build machine. Set the value in the YAML build script. Set the value in Azure DevOps for the build pipeline definition.


1 Answers

Secret variables are:

  • Encrypted at rest with a 2048-bit RSA key.
  • Not returned back to the client. They are automatically masked out of any log output from the build or release.
  • Not decrypted into environment variables. So scripts and programs run by your build steps are not given access by default.
  • Decrypted for access by your build steps. So you can use them in password arguments and also pass them explicitly into a script or a program from your build step (for example as $(password)).

So, Secure variables need to be passed in to tasks as inputs. Check this case: How to add secret variable as task environment variable in VSTS

like image 193
Cece Dong - MSFT Avatar answered Nov 10 '22 13:11

Cece Dong - MSFT