AZ-400: Designing and Implementing Microsoft DevOps Solutions

Design and Implement Pipeline Automation

Introduction

In this lesson, we’ll begin our journey into implementing an orchestration and automation solution using Azure DevOps. With its rich suite of tools, Azure DevOps helps you build, test, and deploy applications while ensuring security and reliability throughout the pipeline.

We’ll cover:

  1. Dependency and security scanning
  2. Testing strategies (unit, integration, load)
  3. Code coverage analysis
  4. Integrations with external tools

Let’s dive in!


Dependency and Security Scanning

Ensuring that your codebase is free from vulnerable or outdated dependencies is a critical first step. Azure Pipelines supports multiple scanning tools and can block builds on detected risks.

Best Practice

Run dependency scans early in your pipeline to catch issues before they propagate downstream.

The image is a slide titled "Dependency and Security Scanning" with three bullet points: "Exploring Dependency Scanning in Azure Pipelines," "Tools for Dependency Scanning," and "Understanding Security Scanning."

Key Steps

  • Configure the dependency-check or npm audit task in your YAML
  • Integrate vulnerability reports in Pull Request checks
  • Automate patching and updates

Common Tools Comparison

ToolPurposeDocumentation
WhiteSource BoltOpen-source vulnerability scanninghttps://docs.microsoft.com/azure/devops/pipelines/ecosystems/whitesource-bolt
SonarCloudCode quality & security analysishttps://sonarcloud.io/documentation
OWASP ZAPDynamic application security testinghttps://owasp.org/www-project-zap/
DependabotAutomated dependency updateshttps://github.com/dependabot/dependabot-core

Testing in CI/CD

Testing is the backbone of any reliable pipeline. By running tests automatically, you can catch regressions and performance issues before they reach production.

The image is a slide titled "Local Tests, Unit Tests, Integration Tests, and Load Tests," listing four topics: the importance of testing in CI/CD, configuring unit tests, setting up integration tests, and implementing load tests.

Test TypeGoalAzure Pipeline Task
Unit TestsVerify individual componentsDotNetCoreCLI@2 / npm test
IntegrationValidate interactions between modulesVSTest@2 / pytest
Load / PerformanceMeasure application behavior under stressApache JMeter task / custom scripts
Smoke / SanityQuick verification of critical featuresInline PowerShell / Bash scripts

Best Practices

  • Run unit tests on each PR
  • Isolate integration tests in a dedicated environment
  • Schedule load tests during off-peak hours

Code Coverage Analysis

Tracking code coverage helps ensure that your tests exercise the most critical parts of your application.

The image is a slide titled "Understanding Code Coverage," listing five topics related to code coverage, including introduction, workings, setup in Azure Pipelines, analysis, and best practices.

Coverage Workflow

  1. Instrument your code (e.g., coverlet, nyc)
  2. Run tests with coverage flags enabled
  3. Publish coverage reports via PublishCodeCoverageResults@1
  4. Analyze gaps and write additional tests

Note

Aim for at least 80% coverage on critical modules, but prioritize test quality over quantity.


Integrating External Tools

Round out your end-to-end DevOps workflow by connecting pipelines to security scanners, artifact repositories, and alerting systems.

IntegrationPurposeAzure DevOps Extension
Azure Container RegistryStore and scan Docker imagesAzure Container Registry Task
GitHub Advanced SecurityCode scanning on PRsGitHub integration via service connection
ArtifactoryUniversal artifact repositoryJFrog Artifactory plugin
PagerDuty / TeamsAlert on pipeline failuresNotification settings in Project Services

Warning

Always secure service connections and protect access tokens using Azure Key Vault.


Next Steps

You now have the framework to:

  • Automate dependency and security checks
  • Enforce comprehensive testing strategies
  • Monitor and improve code coverage
  • Integrate with external tools for a seamless DevOps lifecycle

Proceed to the next lesson to build and deploy your first containerized application with Azure Pipelines.


References

Watch Video

Watch video content

Previous
Purge Data from Source Control