I am trying to dynamically create environments with a set of specific predefined tasks and steps. Anyone ever got this working well enough to post some sample code, or a guide?
I can't add an environment, or tasks to an existing one. I keep getting an error BadRequest, but I don't know what am I doing wrong in the JSON payload.
I can get the existing definition, I can do simple things like update the name of the release definition, comments and description when I update, but once I touch the environments it all breaks.
I am using the online URIs - https://vsrm.dev.azure.com/{acct}/{proj}/_apis/release/definitions?api-version=5.1
Is there any way to get more information on what's wrong with my payload, what's bare minimum, or required?
If you mean create/update environment for the specific release definition, then you can try the following steps:
GET https://vsrm.dev.azure.com/{organization}/{Project}/_apis/release/definitions/{definition ID}?api-version=5.1
Add a new environment with "id":0, set a new name, the ranks of release pipeline stages need to be consecutive natural numbers, for example, the rank in previous stage is "2", then it should be "3" here. Keep others same as previous one
PUT https://vsrm.dev.azure.com/{organization}/{Project}/_apis/release/definitions?api-version=5.1