Forum Discussion
Crafting a Release Pipeline json to use as template
We are running Azure DevOps Server 2020 on-premise. My understanding is that YAML pipelines are not currently available for Release Pipelines. For the time being, I would like to craft a JSON template to use to create Release Pipelines (Definitions) using the API. I have exported an existing Release JSON and tried working with that to create a new Release with Environments/Tasks/Variables, etc., but haven't been able to get it work. When I do get it to create something, it only gets as far as creating a nearly empty Release, but does not configure an Agent Pool, as well as any Tasks. I do not see anything in the JSON I exported related to the Agent Pool and the lack of this may be causing the Tasks creation to fail. Also, when I try some different structures within the JSON, I sometimes get this error:
"Invalid property DeployPhases used in stage 'PROD'. Instead, use DeployStep for tasks."
I have tried moving tasks to the DeployStep node, but it makes no difference. Regardless, the tasks are all located within the DeployPhases node of the export JSON I am building a template from.
Anyone ever successfully build a Release Pipeline with Environments/Tasks, etc., using JSON through the Create Release API? https://learn.microsoft.com/en-us/rest/api/azure/devops/release/definitions/create?view=azure-devops-server-rest-6.0&tabs=HTTP
1 Reply
How about this:
{ "name": "My Release Pipeline", "description": "Created via API", "environments": [ { "name": "PROD", "deployPhases": [ { "phaseType": "agentBasedDeployment", "name": "Run Tasks", "workflowTasks": [ { "name": "Download Build Artifacts", "taskId": "6d15af64-176c-496d-b583-fd2ae21d4df4", "version": "1.*", "inputs": { "buildType": "specific", "project": "your-project-id", "definition": "your-build-definition-id" } }, { "name": "Azure App Service Deploy", "taskId": "d2d5f1c2-3b5e-4b5b-9c1f-1b3f3f3f3f3f", "version": "4.*", "inputs": { "ConnectionType": "AzureRM", "WebAppName": "your-app-name" } } ], "deploymentInput": { "queueId": 123, // Agent Pool ID "parallelExecution": { "parallelExecutionType": "none" } } } ] } ], "variables": { "myVar": { "value": "someValue" } }, "artifacts": [ { "type": "Build", "definitionReference": { "project": { "id": "your-project-id" }, "definition": { "id": "your-build-definition-id" } } } ] }