I am able to schedule a release in multiple timing by using below script
$timinglist=@(1:30,2:30,3:30)
$PATtoken= 'PAT'
Write-Host "Initialize Autnetication COntext" -ForegroundColor DarkBlue
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($PATtoken)"))
$header=@{authorization= "Basic $token" }
$defurl = "https://vsrm.dev.azure.com/Organization/Project/_apis/release/definitions/13?api-version=5.1"
$definition = Invoke-RestMethod -Uri $defurl -Method Get -Headers $header
$hash = @(
@{
triggerType="schedule";
schedule = @{"daysToRelease"="31";"timeZoneId"="India Standard Time";"startHours"=01;"startMinutes"=30}
}),
@{
triggerType="schedule";
schedule = @{"daysToRelease"="31";"timeZoneId"="India Standard Time";"startHours"=02;"startMinutes"=30}
}),
@{
triggerType="schedule";
schedule = @{"daysToRelease"="31";"timeZoneId"="India Standard Time";"startHours"=03;"startMinutes"=30}
})
$definition.triggers = $hash
$definition.variableGroups=@(10,11,12)
$json = @($definition) | ConvertTo-Json -Depth 99
$updatedef = Invoke-RestMethod -Uri $defurl -Method Put -Body $json -ContentType "application/json" -Headers $header
Write-Host ($updatedef.triggers | ConvertTo-Json -Depth 99)
I am able to pass the variable group as $definition.variableGroups=@(10,11,12) . SO here the Variable group 10,11 and 12 will get pass through each of the three releases.But i want to pass the only variable group 10 against release at 01:30 and Variable group 12 at 02:30 and 11 at 03:30. Is it possible