Skip to main content
Version: Next

Azure DevOps Pipelines

Reference Azure

DOCUMENT CATEGORY: Reference SCOPE: Azure DevOps CI/CD pipeline configurations PURPOSE: Document Azure DevOps pipelines for Azure Local deployments MASTER REFERENCE: Azure DevOps Documentation

Status: Active


Overview

Azure DevOps Pipelines configuration for Azure Local deployments. This is a sample equivalent of the primary GitLab CI/CD pipeline, adapted for Azure Pipelines with service connections, environment approvals, and the Terraform task extension.

Pipeline

File: pipelines/azure-devops/azure-local-deploy.yml

Stages

StageAgent PoolApprovalDescription
Validateubuntu-latestNoneTerraform validate + Ansible lint
Planubuntu-latestNoneTerraform plan with artifact
DeployFoundationubuntu-latestproduction environmentTerraform apply
ConfigureOnPremAzureLocal-SelfHostedproduction environmentAnsible site.yml
ConfigureOperationsAzureLocal-SelfHostedproduction environmentMonitoring + management playbooks

Triggers

trigger:
branches:
include: [main]
paths:
include: ['src/terraform/**', 'src/ansible/**', 'config/variables/**']

Setup

1. Service Connection

Create an Azure Resource Manager service connection named AzureLocal-ServiceConnection:

  1. Project Settings → Service connections → New → Azure Resource Manager
  2. Select "Service principal (automatic)" or use an existing SPN
  3. Name: AzureLocal-ServiceConnection
  4. Scope: Target subscription

2. Variable Group

Create a variable group named azurelocal-secrets:

  1. Pipelines → Library → + Variable group
  2. Name: azurelocal-secrets
  3. Add variables:
VariableSecretDescription
ARM_CLIENT_IDNoService Principal ID
ARM_CLIENT_SECRETYesService Principal Secret
ARM_TENANT_IDNoTenant ID
ARM_SUBSCRIPTION_IDNoSubscription ID
TF_BACKEND_RGNoTerraform state resource group
TF_BACKEND_SANoTerraform state storage account

3. Environment

Create a production environment with approval checks:

  1. Pipelines → Environments → New environment → production
  2. Add approval check with required reviewers

4. Self-Hosted Agent Pool

Create an agent pool named AzureLocal-SelfHosted:

  1. Organization Settings → Agent pools → Add pool
  2. Pool type: Self-hosted, Name: AzureLocal-SelfHosted
  3. Register an agent with on-premises network access

5. Terraform Extension

Install the Terraform extension from the marketplace:

  1. Organization Settings → Extensions → Browse marketplace
  2. Search "Terraform" → Install "Terraform by Microsoft DevLabs"

Key Features

  • Service Connections: Azure auth via ARM service connection (no secrets in pipeline)
  • Terraform Task v4: Native Terraform task with backend auto-configuration
  • Environment Approvals: Deployment gates between stages
  • Variable Groups: Centralized secret management
  • Deployment Strategy: runOnce strategy for controlled rollouts

Repository

Source: azurelocal-toolkit/pipelines/azure-devops/


PreviousUpNext
GitHub ActionsPart 2: CI/CD PipelinesPart 3: Automation Guides