Search code examples
tfsrelease-management

TFS 2017 - Is it possible to access the release variable in an environment which was set in another environment in the same release?


In TFS 2017, I set a variable in first environment during the execution using the below command

$myValue= "myValue"

Write-Host ("##vso[task.setvariable variable=myValue;]$myValue")

Is it possible to access this variable in the 2nd environment in the same release?


Solution

  • No, you are using a environment-level variable which for values that vary from environment to environment (and are the same for all the tasks in an environment).

    However, this could be achieved, you just need to use release definition variables instead.

    Share values across all of the environments by using release definition variables. Choose a release definition variable when you need to use the same value across all the environments and tasks in the release definition, and you want to be able to change the value in a single place. You define and manage these variables in the Variables tab in a release definition.

    More details about variables in Release Management, please refer this tutorial.