Azure DevOps · Arazzo Workflow

Azure DevOps Create a YAML Pipeline and Start Its First Run

Version 1.0.0

Create a YAML pipeline from a repo file, confirm it, and trigger a run.

1 workflow 1 source API 1 provider
View Spec View on GitHub AgileCI/CDDevOpsProject ManagementVersion ControlArazzoWorkflows

Provider

microsoft-azure-devops

Workflows

create-and-run-pipeline
Create a YAML pipeline, confirm it, and trigger its first run.
Creates a pipeline from a YAML file in a repository, retrieves it to confirm creation, and starts an initial run.
3 steps inputs: accessToken, apiVersion, branchRef, name, repositoryId, yamlPath outputs: pipelineId, runId
1
createPipeline
pipelines_create
Create a YAML pipeline pointed at the supplied YAML path in an Azure Repos Git repository.
2
confirmPipeline
pipelines_get
Fetch the pipeline by ID to confirm it was created and capture its revision.
3
runPipeline
runs_run
Trigger an initial run of the new pipeline against the requested branch.

Source API Descriptions

Arazzo Workflow Specification

microsoft-azure-devops-pipeline-create-run-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Azure DevOps Create a YAML Pipeline and Start Its First Run
  summary: Create a YAML pipeline from a repo file, confirm it, and trigger a run.
  description: >-
    Onboards a new YAML pipeline pointed at an azure-pipelines.yml file in an
    Azure Repos Git repository and starts its first run. The workflow creates the
    pipeline with the supplied name and configuration, fetches it by the returned
    ID to confirm the configuration, and then triggers a run against the chosen
    branch. Every step spells out its request inline so the flow can be read and
    executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: pipelinesApi
  url: ../openapi/azure-devops-pipelines-api-openapi.yml
  type: openapi
workflows:
- workflowId: create-and-run-pipeline
  summary: Create a YAML pipeline, confirm it, and trigger its first run.
  description: >-
    Creates a pipeline from a YAML file in a repository, retrieves it to confirm
    creation, and starts an initial run.
  inputs:
    type: object
    required:
    - apiVersion
    - name
    - yamlPath
    - repositoryId
    - branchRef
    properties:
      apiVersion:
        type: string
        description: Azure DevOps REST API version (e.g. 7.1).
      name:
        type: string
        description: Display name for the new pipeline.
      yamlPath:
        type: string
        description: Path to the YAML file in the repository (e.g. /azure-pipelines.yml).
      repositoryId:
        type: string
        description: Repository GUID for the Azure Repos Git repository.
      branchRef:
        type: string
        description: Branch ref to run against (e.g. refs/heads/main).
      accessToken:
        type: string
        description: Azure DevOps bearer (OAuth 2.0) access token.
  steps:
  - stepId: createPipeline
    description: >-
      Create a YAML pipeline pointed at the supplied YAML path in an Azure Repos
      Git repository.
    operationId: pipelines_create
    parameters:
    - name: api-version
      in: query
      value: $inputs.apiVersion
    requestBody:
      contentType: application/json
      payload:
        name: $inputs.name
        configuration:
          type: yaml
          path: $inputs.yamlPath
          repository:
            id: $inputs.repositoryId
            type: azureReposGit
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      pipelineId: $response.body#/id
      pipelineName: $response.body#/name
  - stepId: confirmPipeline
    description: >-
      Fetch the pipeline by ID to confirm it was created and capture its
      revision.
    operationId: pipelines_get
    parameters:
    - name: api-version
      in: query
      value: $inputs.apiVersion
    - name: pipelineId
      in: path
      value: $steps.createPipeline.outputs.pipelineId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      revision: $response.body#/revision
  - stepId: runPipeline
    description: >-
      Trigger an initial run of the new pipeline against the requested branch.
    operationId: runs_run
    parameters:
    - name: api-version
      in: query
      value: $inputs.apiVersion
    - name: pipelineId
      in: path
      value: $steps.createPipeline.outputs.pipelineId
    requestBody:
      contentType: application/json
      payload:
        resources:
          repositories:
            self:
              refName: $inputs.branchRef
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      runId: $response.body#/id
      state: $response.body#/state
  outputs:
    pipelineId: $steps.createPipeline.outputs.pipelineId
    runId: $steps.runPipeline.outputs.runId