Skip to main content

Overview

The Intent.ContinuousIntegration.AzurePipelines module generates a basic azure-pipelines.yml file for Azure Pipelines that automates your build, test, and validation workflow. This module creates a CI/CD pipeline that will:
  • Build all .csproj files in the repository
  • Run unit tests for any project whose name is suffixed with Tests
  • Validate Intent Architect changes using the Software Factory CLI to detect outstanding changes

What Gets Generated

Azure Pipeline YAML

A complete pipeline configuration file:
azure-pipelines.yml
trigger:
  branches:
    include:
      - '*'

pool:
  vmImage: 'ubuntu-latest'

variables:
  - name: buildConfiguration
    value: debug
  - name: intentSolutionPath
    value: intent
  # Uncomment after configuring Intent Architect Credentials
  # - group: 'Intent Architect Credentials'

steps:
  - task: DotNetCoreCLI@2
    displayName: 'dotnet build $(buildConfiguration)'
    inputs:
      command: 'build'
      projects: '**/*.csproj'
      arguments: '--configuration $(buildConfiguration)'

  - task: DotNetCoreCLI@2
    displayName: 'dotnet test'
    inputs:
      command: 'test'
      projects: '**/*Tests/*.csproj'
      arguments: '--configuration $(buildConfiguration)'

  - task: PowerShell@2
    displayName: 'install intent cli'
    inputs:
      targetType: 'inline'
      pwsh: true
      script: 'dotnet tool install Intent.SoftwareFactory.CLI --global'

  - task: PowerShell@2
    displayName: 'run intent cli'
    env:
      INTENT_USER: $(intent-architect-user)
      INTENT_PASS: $(intent-architect-password)
      INTENT_SOLUTION_PATH: $(intentSolutionPath)
    inputs:
      targetType: 'inline'
      pwsh: true
      script: |
        if (($Env:INTENT_USER -Eq $null) -or ($Env:INTENT_USER -Like "`$(*)")) {
          Write-Host "##vso[task.logissue type=warning;]Intent Architect Credentials not configured"
          Return
        }
        intent-cli ensure-no-outstanding-changes "$Env:INTENT_USER" "$Env:INTENT_PASS" "$Env:INTENT_SOLUTION_PATH"

Installation

Prerequisites

  • An Azure DevOps organization and project
  • A Git repository connected to Azure DevOps
  • An Intent Architect solution in your repository

Installation Steps

1

Install the module

In Intent Architect, right-click on your application and select Manage Modules. Search for Intent.ContinuousIntegration.AzurePipelines and install it.
2

Run the Software Factory

Execute the Software Factory to generate the azure-pipelines.yml file in your repository root.
3

Commit and push

Commit the generated file to your repository:
git add azure-pipelines.yml
git commit -m "Add Azure Pipelines configuration"
git push
4

Create the pipeline in Azure DevOps

Follow the steps in Creating a Pipeline below.

Creating a Pipeline

This guide assumes you have some familiarity with Azure DevOps Pipelines. For more information, refer to Microsoft’s Create your first pipeline article.
1

Navigate to Pipelines

In Azure DevOps, click on Pipelines in the left navigation pane.Pipelines view (empty)
2

Create Pipeline

Click the Create Pipeline button and follow the wizard to connect to your repository.
3

Select azure-pipelines.yml

Azure DevOps should automatically detect the azure-pipelines.yml file. Review and click Save and run.New pipeline review
4

Review first run

After the first run completes, the pipeline should look like this:After first pipeline run

Expected Warnings

On the first run, you may see warnings:
  • “Project file(s) matching the specified pattern were not found” - This appears if you haven’t added unit test projects yet. Once you have projects with names ending in Tests, this warning will disappear.
  • “Intent Architect Credentials not configured” - This appears until you configure Intent Architect Credentials for the pipeline.

Configuring Intent Architect Credentials

To run the Intent Architect Software Factory CLI, valid Intent Architect account credentials are required.
1

Navigate to Library

In Azure DevOps, go to PipelinesLibrary in the left navigation pane.Azure Pipelines Library view
2

Create Variable Group

Press the + Variable Group button and configure:
  • Variable Group Name: Intent Architect Credentials
New Variable Group
3

Add Username Variable

Press + Add and create:
  • Name: intent-architect-user
  • Value: Your Intent Architect account username/email
4

Add Password Variable

Press + Add again and create:
  • Name: intent-architect-password
  • Value: Your Intent Architect account password
  • Important: Click the padlock icon to make this variable secret
5

Save the Variable Group

Click Save to store the credentials securely.

Enable the Variable Group

1

Edit the pipeline

Return to Pipelines → select your pipeline → click Edit.Pipelines runs view
2

Uncomment the variable group

Find the line:
# - group: 'Intent Architect Credentials'
Remove the # to uncomment it:
- group: 'Intent Architect Credentials'
Edited azure-pipeline.yml file
3

Save and run

Click Save at the top right, then click Run to test the updated pipeline.Save dialogue
4

Grant permissions

On the first run, you’ll see: “This pipeline needs permission to access a resource before this run can continue.”Pipeline needs permissionClick ViewPermit to allow access to the variable group.Waiting for review dialogue
From this point forward, the pipeline will run the Intent Architect Software Factory CLI without needing additional permissions.

Pipeline Stages Explained

1. Build Stage

- task: DotNetCoreCLI@2
  displayName: 'dotnet build $(buildConfiguration)'
  inputs:
    command: 'build'
    projects: '**/*.csproj'
    arguments: '--configuration $(buildConfiguration)'
What it does:
  • Builds all .csproj files in the repository
  • Uses the buildConfiguration variable (default: debug)
  • Fails the pipeline if compilation errors occur

2. Test Stage

- task: DotNetCoreCLI@2
  displayName: 'dotnet test'
  inputs:
    command: 'test'
    projects: '**/*Tests/*.csproj'
    arguments: '--configuration $(buildConfiguration)'
What it does:
  • Runs all xUnit/NUnit/MSTest tests in projects ending with Tests
  • Publishes test results to Azure DevOps
  • Fails the pipeline if any tests fail

3. Intent CLI Validation

- task: PowerShell@2
  displayName: 'run intent cli'
  env:
    INTENT_USER: $(intent-architect-user)
    INTENT_PASS: $(intent-architect-password)
    INTENT_SOLUTION_PATH: $(intentSolutionPath)
  inputs:
    targetType: 'inline'
    pwsh: true
    script: |
      intent-cli ensure-no-outstanding-changes "$Env:INTENT_USER" "$Env:INTENT_PASS" "$Env:INTENT_SOLUTION_PATH"
What it does:
  • Installs the Intent Architect CLI tool
  • Logs in using the credentials from the variable group
  • Validates that all Intent Architect changes have been applied to the codebase
  • Fails if there are outstanding Software Factory changes that haven’t been committed
This ensures that developers don’t forget to run the Software Factory before committing code, maintaining consistency between the Intent Architect models and the generated codebase.

Customization

Change Build Configuration

To build in Release mode instead of Debug:
variables:
  - name: buildConfiguration
    value: release  # Changed from 'debug'

Add Code Coverage

Add coverage collection to the test step:
- task: DotNetCoreCLI@2
  displayName: 'dotnet test'
  inputs:
    command: 'test'
    projects: '**/*Tests/*.csproj'
    arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage"'
    publishTestResults: true

Add NuGet Publishing

Publish NuGet packages after a successful build:
- task: DotNetCoreCLI@2
  displayName: 'dotnet pack'
  inputs:
    command: 'pack'
    packagesToPack: '**/*.csproj'
    configuration: '$(buildConfiguration)'
    outputDir: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifacts'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'packages'

Add Docker Build

Build and push Docker images:
- task: Docker@2
  displayName: 'Build and Push Docker Image'
  inputs:
    command: 'buildAndPush'
    repository: 'myacr.azurecr.io/myapi'
    dockerfile: '**/Dockerfile'
    tags: |
      $(Build.BuildId)
      latest

Best Practices

Use Secret Variables

Always mark sensitive values (passwords, API keys) as secret in variable groups.

Run Tests Early

Fail fast by running tests before expensive operations like Docker builds.

Cache Dependencies

Use Azure Pipeline caching to speed up NuGet restore operations.

Separate Environments

Use different variable groups for dev, staging, and production deployments.

Troubleshooting

Intent CLI Fails with Authentication Error

Problem: The Intent CLI step fails with “Invalid credentials” Solution:
  1. Verify the credentials in the variable group are correct
  2. Ensure the password variable is marked as secret
  3. Check that the variable group name exactly matches Intent Architect Credentials

Tests Not Running

Problem: The test step shows “No test projects found” Solution:
  1. Ensure your test project names end with Tests (e.g., MyApp.Application.Tests)
  2. Verify test projects are included in the solution
  3. Check that test projects reference a test framework (xUnit, NUnit, or MSTest)

Build Fails on First Run

Problem: Build fails due to missing dependencies Solution:
  1. Ensure all NuGet package sources are accessible to Azure DevOps
  2. Add a NuGet restore step if needed:
    - task: DotNetCoreCLI@2
      displayName: 'dotnet restore'
      inputs:
        command: 'restore'
        projects: '**/*.csproj'
    

Integration with Other Modules

Unit Testing

Generated tests run automatically in the pipeline.

Docker

Build and publish Docker images in your pipeline.

Entity Framework

Run database migrations as part of deployment.

OpenTelemetry

Monitor pipeline performance and deployments.

Next Steps

Docker Images

Build containers in your pipeline

Unit Tests

Add comprehensive test coverage

Deployments

Add deployment stages for multiple environments

Build docs developers (and LLMs) love