Reputation: 9113
I am trying to overwrite the value of the variable from Variable Group in Azure DevOps and it's not working. It's always showing the original value.
I wrote my Powershell scripts as shown by these links:
I added the Variable Group and Link it in my Build pipeline.
I wrote the following scripts in Power Shell Script task.
Write-Host "Original BPOwner = $(BPOwner)"
Write-Host "Changing value of BPOwner to Bright Ran"
Write-Host "##vso[task.setvariable variable=BPOwner;]Bright Ran"
Write-Host "New BPOwner = $(BPOwner)"
However, in the Build, it's always showing the original value and it's never changed to the value I want to set.
Could you please suggest me how I could set this value in the Build Pipeline?
Upvotes: 4
Views: 3969
Reputation: 41545
The new value available only in the next tasks, not in the same task when you change the value. for example, I added another PS task with Write-Host "New BPOwner = $(BPOwner)"
:
The above it's the behavior of the logging command ##vso[task.setvariable variable]
and not only to the variable group.
Upvotes: 4