Reputation: 13
I am trying to set up an API-key to be a global variable that is accessible across all of my TFS2015 Builds. Since TFS2015 seems to lack this feature, I am attempting to use a system environment variable on the build server that is then referenced in the build definitions.
According to Microsoft's documentation, this should be possible. So I have set up a system variable (call it APIKey) on the build server and referenced it within the arguments of a build step using the standard syntax (i.e. "ApiKey=$(APIKey)"). However, instead of replacing the variable with the API-key in the system variable it is trying to use $(APIKey) as the value and causing the build to fail.
It also occurred to me that this custom environment variable would instead be set somewhere in the build agent folder itself but, after some poking around, I'm not sure where or how I would do that.
Are either of these things actually doable?
Upvotes: 1
Views: 788
Reputation: 29966
Following are my steps to achieve this:
Restart the build agent machine.
Use the variable in build definition. Here I use cmd task as an example and use the $(testvar) as its argument:
The task will read the value from system variable as following:
Upvotes: 2