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 in Other DevOps Questions by Edureka
• 840 points
248 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 by Bhavitha
• 980 points

Related Questions In Other DevOps Questions

0 votes
0 answers
+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
1,583 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 in Other DevOps Questions by Bhavitha
• 980 points
74 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP