Skip to content
RankCore.AI
← All posts

Azure DevOps Part 4: CI/CD Pipelines, Artifacts, and Release Pipelines Explained

· Azure DevOps, CI/CD, Azure Pipelines, Azure Artifacts, DevOps, azure-devops-series

In Part 3 we covered agents, variables, secrets, and service connections: the plumbing that lets a pipeline run and talk to the outside world. Part 4 is where that plumbing starts doing real work. It covers the build pipeline (CI), the two kinds of artifacts, and the release pipeline (CD) with approvals, gates, and a rollback plan. The video above is a 2:20 walkthrough. This article follows its order and adds what a solutions architect would tell a team before production.

Azure DevOps Part 4 of 6 title card listing Build pipeline (CI), Artifacts, and Release pipeline (CD)

Part 4 of 6: build pipeline, artifacts, and release pipeline.

Azure DevOps series

All six parts of the series, in order:

  1. Part 1: Core Services & Architecture
  2. Part 2: Repos, Branching & YAML Pipelines
  3. Part 3: Agents, Variables, Secrets & Service Connections
  4. Part 4: CI/CD, Build, Artifacts & Release (you are here)
  5. Part 5: Multi-Stage Pipelines, Security & Troubleshooting
  6. Part 6: End-to-End Workflow, Best Practices & Interview Prep

Previous: Part 3: Agents, Variables, Secrets & Service Connections · Next: Part 5: Multi-Stage Pipelines, Security & Troubleshooting

Why CI and CD are two different contracts

Continuous integration promises that every change merged to a shared branch has been built, tested, and analyzed by a machine, producing a versioned output. The question CI answers: is this change safe to integrate?

Continuous delivery promises that any build that passed CI can be deployed to any environment through a repeatable, auditable process. The question CD answers: is this build safe in front of customers, and can we undo it?

The hand-off between the two is the artifact. CI produces it once. CD consumes it many times. The design principle to remember: build once, deploy the same bits everywhere. Artifact types, approvals, and rollback all exist to protect it.

The build pipeline: seven steps from trigger to results

The video walks the CI run as a seven-step flow, and it is a good mental template even when your real pipeline has more stages.

Build pipeline (CI) diagram: trigger fires, restore dependencies, build the app, run tests, code analysis, publish artifact, run complete

The build pipeline: 1 Trigger fires, 2 Restore dependencies, 3 Build the app, 4 Run tests, 5 Code analysis, 6 Publish artifact, 7 Run complete.

1. Trigger fires. A push, a pull request, a schedule, or another pipeline starts the run. In YAML you declare trigger: (CI) and pr: (pull request validation). Use path filters on large repositories so a documentation change does not rebuild the platform.

2. Restore dependencies. NuGet, npm, Maven, or pip pulls the packages the code needs. This is usually the slowest and least reliable step because it depends on the network and public registries.

3. Build the app. The output should be deterministic: the same commit produces the same binary. Pin your SDK version (for example with UseDotNet@2).

4. Run tests. Unit tests first, because they are quick. Integration tests come next. Keep slow end-to-end tests for a later stage so they do not block every pull request.

5. Code analysis. The video names SonarQube for bugs and vulnerabilities. Static analysis, dependency scanning, and secret scanning belong in the build, where a failure is cheap.

6. Publish artifact. The output is uploaded so later stages can use it.

7. Run complete. The run records logs and test results, and that record is evidence. When someone asks in six months why a release went out, the run summary answers.

A realistic CI skeleton

Here is a compact YAML pipeline that mirrors those seven steps for a .NET web app. Adapt the tasks for Node, Java, or Python.

trigger:
  branches:
    include: [ main ]
  paths:
    exclude: [ docs/*, README.md ]

pr:
  branches:
    include: [ main ]

pool:
  vmImage: ubuntu-latest

variables:
  buildConfiguration: Release

steps:
- task: UseDotNet@2
  inputs:
    packageType: sdk
    version: 8.x

- task: Cache@2
  inputs:
    key: 'nuget | "$(Agent.OS)" | **/packages.lock.json'
    restoreKeys: 'nuget | "$(Agent.OS)"'
    path: $(Pipeline.Workspace)/.nuget/packages
  displayName: Cache NuGet packages

- script: dotnet restore --locked-mode
  displayName: Restore
  env:
    NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages

- script: dotnet build --no-restore -c $(buildConfiguration)
  displayName: Build

- script: >
    dotnet test --no-build -c $(buildConfiguration)
    --logger trx --collect "XPlat Code Coverage"
  displayName: Test

- task: PublishTestResults@2
  condition: succeededOrFailed()
  inputs:
    testResultsFormat: VSTest
    testResultsFiles: '**/*.trx'

- script: dotnet publish src/Web -c $(buildConfiguration) --no-build -o $(Build.ArtifactStagingDirectory)/web
  displayName: Publish app

- publish: $(Build.ArtifactStagingDirectory)/web
  artifact: web

Three details matter here. succeededOrFailed() on the test results task means you still get a report when tests fail. --locked-mode makes restore fail if the lock file is out of date, stopping silent dependency drift. And publish is the shortcut for the Publish Pipeline Artifact task.

Keep builds fast and fail early

The video gives two short rules for fast builds: keep builds fast and fail early, and cache dependencies and always publish test results and coverage.

Fast builds card: keep builds fast, fail early; cache dependencies

Fast builds: fail early, cache dependencies, and always publish test results.

A slow pipeline changes behavior: developers batch more changes per pull request and start ignoring red builds. Set a budget, such as ten minutes for pull request validation, and treat a breach as a defect.

Practical ways to hit that budget:

  • Order steps by cost. Lint, compile, and unit tests run before anything that provisions infrastructure.
  • Cache dependencies. The Cache@2 task restores a folder keyed on a hash of your lock file. A cache hit turns a minutes-long restore into seconds. The key must include something that changes when dependencies change, or you will serve stale packages.
  • Run independent work in parallel. Jobs without dependencies run in parallel, subject to the parallel jobs your organization has purchased. A strategy: matrix can split test suites across agents.
  • Publish test results and coverage every time. PublishTestResults@2 and PublishCodeCoverageResults@2 give the run a Tests tab and trend charts instead of only pass or fail.

A cache is an optimization, not a source of truth: the build must still pass cold.

Two kinds of artifacts, and the question interviewers love

The narration in the video is blunt: this is the question interviewers love. Azure DevOps has two completely different things that people casually call "artifacts."

Two kinds of artifacts: pipeline artifacts (files between stages, not versioned, pipeline retention) and artifacts feeds (NuGet, npm, Maven, Python, versioned packages)

Pipeline artifacts move files between stages. Artifacts feeds manage versioned packages.

Pipeline artifacts

A pipeline artifact is a folder or file produced by one run and handed to later jobs or stages of that same run, or to another pipeline. As the video says, they carry files between stages, are not versioned in the package-management sense, and live as long as the pipeline run does under your retention settings.

In YAML you publish and download them with two shortcuts:

# in the build job
- publish: $(Build.ArtifactStagingDirectory)/web
  artifact: web

# in a later job
- download: current
  artifact: web

Two things worth knowing: publishing pipeline artifacts is not supported in classic release pipelines, and deleting a pipeline run deletes the artifacts attached to that run, so retention policy and release traceability are linked. If a release must be redeployable for a year, either keep its run or promote its output into a feed.

Azure Artifacts feeds

A feed is a package repository. It hosts NuGet, npm, Maven, Python, and Universal packages, as the video lists. Packages are versioned and shared across pipelines, projects, and teams, and they are immutable: once published, a version number is permanently reserved. Republishing the same version fails by design, so nobody can quietly swap the bits behind 1.4.2.

Feeds also support upstream sources. A package installed from a public registry such as NuGet.org or npmjs.com is saved into your feed automatically. The benefits: one config entry for developers and pipelines, resilience when the public registry has an outage, and a record of exactly which versions you consumed.

The rule of thumb

The video compresses it to one line:

Pipeline artifacts move build outputs; feeds manage packages.

Use a pipeline artifact for the compiled web app that goes from Build to the Deploy stages. Use a feed for the shared library other teams depend on, versioned with semantic versioning.

The release pipeline: the same artifact, many environments

Now the CD half. The video shows a promotion path of Dev, Test, UAT, Production, with deployment targets that include a VM, a web app, Kubernetes, and on-premises servers.

Release pipeline (CD) diagram: Dev, Test, UAT, then Production, with deployment targets VM, web app, Kubernetes, on-prem

Release pipeline (CD): the same artifact is promoted through Dev, Test, UAT, and Production.

Microsoft supports two styles. Classic release pipelines are a visual designer with artifacts, stages, and gates. YAML pipelines express the same ideas as stages in code, with environments as targets and deployment jobs to run the steps. For new work, put CD in YAML alongside CI so the whole delivery process is reviewed and versioned like code. Part 5 covers multi-stage YAML.

A deployment stage uses a deployment job bound to an environment, with a strategy such as runOnce and a deploy step like AzureWebApp@1 that uses a service connection. Part 5 shows a full example.

Notes for architects:

  • A deployment job records deployment history on the environment, valuable for audits, and automatically downloads the current run's artifact in its deploy hook.
  • Deployment jobs support three strategies: runOnce, rolling, and canary, with lifecycle hooks (preDeploy, deploy, routeTraffic, postRouteTraffic, and on: failure / on: success). Use the hooks for health checks and for rollback steps.
  • Targets decide the agent story. App Service deploys from a Microsoft-hosted agent through a service connection. On-premises servers need a self-hosted agent or a virtual machine resource on the environment.
  • One service connection per environment, scoped to the lowest privilege that works. The Dev connection should not be able to touch Production.

Approvals and gates: where humans and automation both sign off

Approvals and gates card: approvals (a person signs off, manager approves prod) and gates/checks (automatic: Azure Monitor alerts, work items, REST API, test results)

Approvals are a person signing off. Gates, called checks in YAML, are automatic.

Approvals are a person signing off. A manager approves the production deployment. In YAML you configure this as an Approvals check on an environment, with named users or groups, optional instructions, and a timeout. If nobody responds before the timeout, the stage is skipped.

Gates are automatic. In classic releases they are called gates; in YAML pipelines the equivalent mechanism is checks. The video lists Azure Monitor alerts, work items, a REST API call, and test results. In current Microsoft documentation the dynamic checks are Approval, Invoke Azure Function, Invoke REST API, Business Hours, and Query Azure Monitor alerts, and classic gates include Query Work Items. A gate is a question a machine asks before the release continues: are there active alerts, are there open blocking bugs, does the scanner report this build as clean?

A few facts that save people from surprises:

  • Checks are not defined in the YAML file. They are set on the resource (environment, service connection, agent pool, variable group, secure file, or repository) by its owner in the web UI. That is deliberate: someone who edits the pipeline YAML cannot remove the guardrail.
  • Before a stage runs, all checks on all resources used in that stage must pass. There are categories with an order: static checks first (Branch control, Required template, Evaluate artifact), then pre-check approvals, then dynamic checks, then post-check approvals, then an exclusive lock.
  • Branch control restricts Production to builds from allowed, protected branches such as main.
  • Approvals have an option for whether the person who triggered the run may approve it. For production, forbid self-approval to get separation of duties.

Approval design is a trade-off. Too many approvals create rubber-stamping. Too few and an unreviewed change reaches customers. A common pattern: no approval for Dev and Test, gates plus a team lead for UAT, and a production approval from a different group than the developers, ideally with a business-hours check so releases do not land at 2 a.m.

The rollback plan: decide before you need it

Rollback plan card: stage fails, redeploy last known good artifact, manual or automatic

Rollback plan: when a stage fails, redeploy the last known good artifact, manually or automatically.

The video's last substantive point is the shortest and arguably the most important: if a stage fails, redeploy the last known good artifact, manually or automatically, and test your rollback first.

Because CD deploys an immutable artifact, rollback is mostly "deploy the previous artifact again." If you rebuild for rollback, you ship something never tested.

Options, from simplest to most advanced:

  1. Redeploy a previous run. Rerun the deployment stage of the last good run, or redeploy the earlier classic release. This works while its artifact is retained.
  2. Automatic rollback in a deployment job. Use the on: failure lifecycle hook to run steps that restore the previous version, for example by swapping a slot back or re-pointing a Kubernetes deployment.
  3. Deployment slots and blue-green. Deploy to a staging slot, warm it, run health checks, then swap. Rollback is a swap back, with seconds of impact.
  4. Canary or rolling strategy. Expose a small share of traffic first and let postRouteTraffic watch health.
  5. Feature flags. Turning a flag off is the fastest rollback there is.

Pitfalls to design around:

  • Database changes. A schema migration is not reversed by redeploying code. Use expand and contract: add columns first, deploy code that works with both shapes, remove old columns later.
  • Retention. If retention deletes the last good run, your rollback target is gone. Keep runs for released builds or push released packages to a feed.
  • Untested rollback. A rollback script that has never run is a hope, not a plan. Practice it in Dev and UAT.

Interview questions from this part

Pipeline artifact vs Artifacts feed? Pipeline artifacts carry build outputs between stages and follow run retention. Feeds host versioned packages that many pipelines and teams consume.

Approvals vs gates? Approvals are human sign-off. Gates, called checks in YAML, are automated conditions such as Azure Monitor alerts, work item queries, REST API calls, or Azure Functions.

What comes next

You now have the delivery spine: a fast build, a published artifact, a promotion path with human and automated gates, and a plan for failure. In Part 5: Multi-stage pipelines, security, and troubleshooting, we put CI and CD into a single YAML file, reuse logic with templates, lock down access with RBAC, and learn how to debug a pipeline that breaks.

If you want more short, practical lessons like this on AI, code, cloud, and security, follow @rankcore.ai on Instagram.

Want to go deeper?

Our step-by-step video courses turn these ideas into results.

See courses

Comments

Sign in or create a free account to join the discussion.

No comments yet — be the first.