Skip to content

Instantly share code, notes, and snippets.

@Tiberriver256
Created February 7, 2023 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tiberriver256/f5f77a75846ba51a4b723cd67ef06106 to your computer and use it in GitHub Desktop.
Save Tiberriver256/f5f77a75846ba51a4b723cd67ef06106 to your computer and use it in GitHub Desktop.
Update an Azure DevOps Task Group Input Parameter type from string to a multiLine string
# NOTE:
# This change will probably be reverted the next time you save the task group in the UI... I am sorry
$MyPat = "INSERT_PAT_TOKEN_WITH_TASK_GROUP_SCOPES"
$TaskGroupId = "INSERT_TASK_GROUP_ID"
$Organization = "INSERT_ORGANIZATION"
$Project = "INSERT_PROJECT"
$VariableToChange = "INSERT_VARIABLE_NAME_YOU_WANT_MULTILINE"
## DO NOT MODIFY BELOW THIS LINE
$B64Pat = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("`:$MyPat"))
$Headers = @{
Authorization = "Basic $B64Pat"
}
$TaskGroupUri = "https://dev.azure.com/$Organization/$Project/_apis/distributedtask/taskgroups/$($TaskGroupId)?api-version=7.0"
$TaskGroup = Invoke-RestMethod -Headers $Headers -Uri $TaskGroupUri
$EnvironmentVarsInput = $TaskGroup.value[0].inputs | Where-Object { $_.name -eq "$VariableToChange" }
$EnvironmentVarsInput.type = "multiLine"
$EnvironmentVarsInput.properties = [pscustomobject]@{
"resizable"= "true"
"rows" = "2"
}
Invoke-RestMethod -Headers $Headers -Method Put -Uri $TaskGroupUri -Body ($TaskGroup.value[0] | ConvertTo-Json -Depth 100) -ContentType "application/json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment