Run Azure Pipeline

Action ID: azure:pipeline:run
NPM Package:

@backstage-community/plugin-scaffolder-backend-module-azure-devops

Description

Runs an Azure pipeline and returns its execution status, URL, and timeout information.

Input Schema

PropertyTypeDescriptionRequired
hoststring-
tokenstring-
branchstring-
projectstring-
pipelineIdstring-
organizationstring-
pipelineTimeoutnumber-
pollingIntervalnumber-
templateParametersobject-

Output Schema

PropertyTypeDescriptionRequired
pipelineRunIdnumber-
pipelineOutputobject-
pipelineRunUrlstring-
pipelineRunStatusstring-
pipelineTimeoutExceededboolean-

Usage Examples

Run a CI pipeline on the default branch after generating a service

This runs a CI pipeline after fetching a service template. Use this when you want to kick off a build on the pipeline default branch right after scaffolding. It uses fetch:template to set up files and debug:log to report the run URL.

Copy
steps:
  - id: fetch_skeleton
    action: fetch:template
    input:
      url: https://github.com/acme/templates/node-service
      targetPath: ./service

  - id: run_ci_pipeline
    action: azure:pipeline:run
    input:
      organization: acme-org
      project: payments
      pipelineId: "215"
      token: ${{ parameters.azurePat }}
      pollingInterval: 10

  - id: log_run_url
    action: debug:log
    input:
      message: Azure pipeline run URL ${{ steps.run_ci_pipeline.output.pipelineRunUrl }}

Run a pipeline on a feature branch with template parameters

This triggers a pipeline on a feature branch and passes pipeline variables. Use this to build or test a branch with custom values.

Copy
steps:
  - id: run_branch_pipeline
    action: azure:pipeline:run
    input:
      organization: contoso
      project: checkout
      pipelineId: "731"
      token: ${{ parameters.azurePat }}
      branch: refs/heads/feature/checkout-flow
      pollingInterval: 15
      templateParameters:
        serviceName: checkout-api
        environment: dev
        imageTag: ${{ parameters.imageTag }}
        runE2E: true
        buildConfiguration: Release

  - id: log_status
    action: debug:log
    input:
      message: Pipeline status ${{ steps.run_branch_pipeline.output.pipelineRunStatus }} at ${{ steps.run_branch_pipeline.output.pipelineRunUrl }}

Run a pipeline with a timeout and custom polling

This runs a pipeline with a short polling interval and an upper bound for total wait time. Use this to prevent long waits in the scaffolder when builds are queued or slow.

Copy
steps:
  - id: run_build_with_timeout
    action: azure:pipeline:run
    input:
      organization: acme-corp
      project: platform
      pipelineId: "402"
      token: ${{ parameters.azurePat }}
      pollingInterval: 5
      pipelineTimeout: 900

  - id: handle_timeout
    if: ${{ steps.run_build_with_timeout.output.pipelineTimeoutExceeded }}
    action: debug:log
    input:
      message: Pipeline exceeded timeout at ${{ steps.run_build_with_timeout.output.pipelineRunUrl }}

  - id: handle_completion
    if: ${{ !steps.run_build_with_timeout.output.pipelineTimeoutExceeded }}
    action: debug:log
    input:
      message: Pipeline finished with status ${{ steps.run_build_with_timeout.output.pipelineRunStatus }}

Run a pipeline on a self-hosted Azure DevOps Server

This targets a self-hosted Azure DevOps Server by specifying the host. Use this when your organization runs Azure DevOps on premises.

Copy
steps:
  - id: run_on_prem_pipeline
    action: azure:pipeline:run
    input:
      host: ado.acme.local
      organization: enterprise
      project: legacy-apps
      pipelineId: "987"
      token: ${{ parameters.adoToken }}
      branch: refs/heads/release/2025.10
      pollingInterval: 20

  - id: log_on_prem_result
    action: debug:log
    input:
      message: On prem pipeline ${{
        steps.run_on_prem_pipeline.output.pipelineRunId
      }} status ${{ steps.run_on_prem_pipeline.output.pipelineRunStatus }}

Conditionally run follow-up steps based on pipeline status

This runs a pipeline and then branches the workflow based on success or failure. Use this to run additional steps only when the pipeline succeeds.

Copy
steps:
  - id: trigger_release
    action: azure:pipeline:run
    input:
      organization: contoso
      project: retail
      pipelineId: "1201"
      token: ${{ parameters.azurePat }}
      templateParameters:
        releaseChannel: stable
        approveAutomatically: false

  - id: on_success
    if: ${{ steps.trigger_release.output.pipelineRunStatus == 'succeeded' }}
    action: debug:log
    input:
      message: Release succeeded at ${{ steps.trigger_release.output.pipelineRunUrl }}

  - id: on_failure
    if: ${{ steps.trigger_release.output.pipelineRunStatus != 'succeeded' }}
    action: debug:log
    input:
      message: Release did not succeed status ${{ steps.trigger_release.output.pipelineRunStatus }}