<p>I'm not sure my approach is any "better". However, what I have done in the past was to use Table Storage or Cosmos DB to store the key-value pairs that needed to be persisted between each stage.</p>

<p>The general schema was:</p>

<ul>
<li><strong>Key</strong>: <em>buildNum-variableName</em> </li>
<li><strong>Value</strong>: <em>variableValue</em></li>
</ul>

<p>I then created various wrappers for the SDK to access from PowerShell and MSBuild, this also enabled chaining multiple builds together to create a CI/CD pipeline.</p>

CC BY-SA 4.0
2019-11-07T17:15:29.060Z
2019-11-07T17:15:29.060Z
Richard Slater
<p>I have a multi-configuration web application I'm using parallel deployments, leveraging Task Groups for reusing my deployment code.</p>

<p>I've been using Powershell tasks and the <code>##vso[task.setvariable variable]</code> but those only are readable by other tasks (particularly non-PowerShell tasks) if they correspond to top-level variables at the Build/Release level.  Variables that are only local to the task-group.</p>

<p>Basically, the behavior described in <a href="https://github.com/Microsoft/azure-pipelines-tasks/issues/3116" rel="nofollow noreferrer">Issue #3116</a></p>

<p>Does anybody have a better workaround for this issue besides binding all your variables right to the root with identical names?</p>

<azure-pipelines><powershell>
How to pass variables between build/deploy tasks in a TaskGroup in VSTS 16.131.28601.4
Pxtl
# How to pass variables between build/deploy tasks in a TaskGroup in VSTS 16.131.28601.4

(Asked by: username_0 on 2019-11-04)

I have a multi-configuration web application I'm using parallel deployments, leveraging Task Groups for reusing my deployment code.

I've been using Powershell tasks and the `##vso[task.setvariable variable]` but those only are readable by other tasks (particularly non-PowerShell tasks) if they correspond to top-level variables at the Build/Release level. Variables that are only local to the task-group.

Basically, the behavior described in [Issue #3116](https://github.com/Microsoft/azure-pipelines-tasks/issues/3116)

Does anybody have a better workaround for this issue besides binding all your variables right to the root with identical names?

**Tags:** azure-pipelines, powershell


---

## 1 answers

### Answer by username_1 on 2019-11-07. Score: 1

I'm not sure my approach is any "better". However, what I have done in the past was to use Table Storage or Cosmos DB to store the key-value pairs that needed to be persisted between each stage.

The general schema was:

* **Key**: *buildNum-variableName*
* **Value**: *variableValue*

I then created various wrappers for the SDK to access from PowerShell and MSBuild, this also enabled chaining multiple builds together to create a CI/CD pipeline.


---

