Azure DevOps Output Variables

In my re-writing of my Infrastructure for MtgDiscovery I have a Task Group that I want to get the SystemIdentity for a resource.

My plan for this innocuous task was to use output variables.
Seems simple.

Write-Host "##vso[task.setvariable variable=Resource.SystemIdentity;isSecret=false;isOutput=true;]$principalId"

No....

Tasks don't like output variables. Maybe if I switch to yaml... but for now... NOooooo
Silly me and using the classic UI

Instead of using an output variable, I defined a variable,

then in the task SET, but did not declare it as output.

Write-Host "##vso[task.setvariable variable=Resource.SystemIdentity;isSecret=false;isOutput=false;]$principalId"

That's pretty much it. Just don't use output variables. Define the variable and set it in the pipeline... Simple.

So simple it's probably why it's a little bit hard to find info on. I almost didn't write this about it. But I spent a couple hours, so it's worth a few more to document it.

Show Comments