Created
February 5, 2020 17:28
-
-
Save bayological/0e3f7d4f8d3626a6b6a7b426f31aace6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/Release/definitions/$($env:RELEASE_DEFINITIONID)?api-version=5.0" | |
#Get definition | |
$pipeline = Invoke-RestMethod -Uri $url -Headers @{ | |
Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN" | |
} | |
#Update variable | |
$pipeline.variables.MyVariableName.value = "New value" | |
#Update the modified object to JSON | |
$json = @($pipeline) | ConvertTo-Json -Depth 99 | |
#Update the definition via api | |
$updatedef = Invoke-RestMethod -Uri $url -Method Put -Body $json -ContentType "application/json" -Headers @{Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment