PuiChee (PC) Chan and Kristen Womack explain how to use Azure Developer CLI (azd) with Azure DevOps Pipelines to achieve consistent end-to-end CI/CD, focusing on infrastructure-as-code and reliable multi-stage deployments.

Azure Developer CLI: From Dev to Prod with Azure DevOps Pipelines

Authors: PuiChee (PC) Chan, Kristen Womack

This article expands on an earlier post about dev-to-prod promotion using GitHub Actions by adapting the ‘build once, deploy everywhere’ CI/CD pattern to Azure DevOps Pipelines. The key focus is on how to leverage the Azure Developer CLI (azd) in combination with Azure DevOps YAML pipelines for consistent and reliable deployments across different environments.

Environment-Specific Infrastructure

The deployment strategy uses a single set of Bicep templates with a configurable envType parameter to tailor resource provisioning for each environment (Dev, Prod, etc.). The same techniques work across both GitHub Actions and Azure DevOps.

Artifact-Based Deployment Pattern

Rather than moving local files between jobs, the recommended approach uses Azure DevOps’ artifact system:

  • Cross-job compatibility for artifacts
  • Automated cleanup and retention
  • Improved traceability with visible download history
  • Integrated platform security

This shifts the deployment process to the industry-standard: “build once, deploy everywhere” using pipeline-managed artifacts.

Multi-Stage Pipeline Structure

The YAML pipeline is organized into three major stages:

  1. Build and Package: Compiles and packages the application.
  2. Deploy to Development: Provisions infrastructure and deploys the build to the development environment.
  3. Promote to Production: Deploys to production with environment-specific variables after optional validation gates.

Sample YAML Snippet:

trigger:
  - main

pool:
  vmImage: ubuntu-latest

stages:
  - stage: build_and_test
  - stage: deploy_development
    dependsOn: build_and_test
  - stage: promote_to_Prod
    dependsOn: deploy_development

Each stage installs azd, configures authentication, and executes the appropriate azd commands to package, provision, and deploy using published pipeline artifacts.

Enhancing the Pipeline

  • Validation Gate: Before promoting to production, add validation steps (e.g., health checks, security scans, integration tests).
  • Environment Variables: Utilize dedicated Azure DevOps pipeline variables for production settings (e.g., AZURE_PROD_ENV_NAME, AZURE_PROD_LOCATION).

End-To-End Setup Instructions

  1. Initialize your project with azd (azd init)
  2. Edit azure.yaml to configure Azure DevOps as the CI/CD provider and set pipeline variables
  3. Provision development and production environments (azd up and azd provision)
  4. Configure CI/CD Pipeline using azd pipeline config and Azure DevOps UI

Full walkthrough and code samples are available at this GitHub repo.

Pro Tip: AI-Powered Pipeline Writing

Use GitHub Copilot for Azure inside VS Code to optimize pipelines:

  • Debug YAML issues
  • Suggest validation/testing steps
  • Recommend advanced deployment patterns

Questions or want to share your implementation approach? Join the project discussion.

Conclusion

This approach lets development teams enjoy consistent CI/CD practices on Azure, with repeatable infrastructure patterns, robust artifact management, and cross-environment deployments. By leveraging both the Azure Developer CLI and platform-native pipeline features, organizations can streamline and secure their release processes.

This post appeared first on “Microsoft DevBlog”. Read the entire article here