Azure DevOps yaml passing variable using vso task setvariable not working

0 votes
I'm trying to convert parameter envList to individual env names in the next yaml step (code below). envList = "NameDevEnv, NameQAEnv, NameStageEnv, NameProdEnv" envList = "NameDevEnv, NameQAEnv, NameStageEnv, NameProdEnv"

I'm trying to pass NameDevEnv, NameQAEnv, NameStageEnv, and NameProdEnv to separate yaml variables/parameters, and then pass these names to templates such that those envs are produced with the given names.
Feb 8, 2022 in Other DevOps Questions by Edureka
• 850 points
1,576 views

1 answer to this question.

0 votes

You can stop the pipeline from running by turning off the agents.

Go to Project Settings—>Select the agent pool -->


Go to Agents tab-->Disable all the agents.

Disable all agents under the Agents tab.

$PAT="Personal Access Token"

$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PAT)"))

#list build definiations api
$url = "https://dev.azure.com/org/proj/_apis/build/definitions?api-version=6.1-preview.7"

#list all build definitions
$AllDefinitons = Invoke-RestMethod -Uri $url1 -Headers @{Authorization = ("Bearer {0}" -f $base64AuthInfo)} -Method get

#get all the definition ids
$Ids = $AllDefinitons.value | select id

foreach($id in $Ids){
 
   $definitionUrl="https://dev.azure.com/org/proj/_apis/build/definitions/$($id.id)?api-version=6.1-preview.7"

   #get the definition of each build pipeline
   $definiton = Invoke-RestMethod -Uri $definitionUrl-Headers @{Authorization = ("Bearer {0}" -f $base64AuthInfo)} -Method get

   #set queueStatus to paused
   $definiton.queueStatus= "paused"

   #update the definition
   Invoke-RestMethod -Uri $definitionUrl-Headers @{Authorization = ("Basic {0}" -f $base64AuthInfo)} -Method put -Body (ConvertTo-Json $definiton-Depth 100) -ContentType "application/json"

}
answered Feb 8, 2022 by Bhavitha
• 1,000 points

Related Questions In Other DevOps Questions

0 votes
0 answers

Azure Devops Tasks not showing up in my Task Template List

I created a task using the templates ...READ MORE

Mar 30, 2022 in Other DevOps Questions by Kichu
• 19,050 points
502 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,530 views
+2 votes
1 answer
0 votes
1 answer

JavaScript heap out of memory in Angular 7 using Azure DevOps

Try running the prod build as follows: node ...READ MORE

answered Feb 9, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
2,811 views
0 votes
1 answer

How to show Azure DevOps wiki attachment that has been created by API

This doesn't appear to be an issue ...READ MORE

answered Feb 8, 2022 in Other DevOps Questions by Bhavitha
• 1,000 points
1,114 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP