Azure DevOps

Integrate Bricks CLI into Azure DevOps pipelines to publish blueprints, plan changes on PRs, and deploy with approval gates.

Integrate Bricks CLI into your Azure DevOps pipelines to publish blueprints, plan infrastructure changes on PRs, and deploy across collections with approval gates.


Setup

  1. Create a Variable Group named bluebricks-credentials with a secret BRICKS_API_KEY (see Long-Lived Tokens)

  2. Create Environments (bluebricks-dev, bluebricks-staging, bluebricks-production) with approval checks on staging and production

Install the CLI in any pipeline job:

- script: |
    /bin/bash -c "$(curl -fsSL https://brickscli.s3.eu-west-1.amazonaws.com/releases/latest/install.sh)"
  displayName: 'Install bricks CLI'

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.

CI/CD Flags

See bricks install and bricks blueprint publish for full reference.

Flag / Env Var
Purpose

BRICKS_API_KEY

Authenticate without browser login

BRICKS_NON_INTERACTIVE

Suppress interactive prompts

--plan-only

Preview changes without applying

--yes

Auto-approve and apply


Deploy Pipeline

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
circle-info

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 validationarrow-up-right instead to trigger plans on pull requests.


Publish Pipeline

Publishes blueprints to the registry when changes merge to main:


Deployment Manifest

Each environment has a deploy.yaml:

See Deployment Manifest File Format for the full reference. For blueprint definitions (bricks.yaml), see Creating Blueprints.


Repository Structure


Troubleshooting

Issue
Solution

authentication required

Verify BRICKS_API_KEY is set and linked to the pipeline

Pipeline hangs on publish

Bump the version in bricks.yaml before merging - the CLI prompts when a version already exists

INVALID_PACKAGE_NAME

Use underscores, not hyphens (e.g., aws_vpc not aws-vpc)

Last updated

Was this helpful?