Integrate bricks CLI into your Azure DevOps pipelines to publish blueprints, plan infrastructure changes on PRs, and deploy across collections with approval gates.
Setup
Create a Variable Group named bluebricks-credentials with a secret BRICKS_API_KEY (see Long-Lived Tokens)
Create Environments (bluebricks-dev, bluebricks-staging, bluebricks-production) with approval checks on staging and production
The CLI reads configuration from environment variables prefixed with BRICKS_. Set BRICKS_NON_INTERACTIVE and BRICKS_API_KEY at the pipeline level so every step picks them up automatically. Since BRICKS_API_KEY is a secret, it must also be mapped via env: on each step.
Plans on PRs, then deploys through dev (automatic), staging (approval), and production (approval). Uses ${{ each }} to loop over environments so the deploy logic is defined once:
Multi-environment deployment pipeline with plan, dev, staging, and production stages
YAML pr: triggers work only with GitHub and Bitbucket Cloud repositories. If your code is in Azure Repos Git, configure a branch policy for build validation instead to trigger plans on pull requests.
Publish Pipeline
Publishes blueprints to the registry when changes merge to main: