Courseiva
Design and implement build and release pipelinesmediumMultiple ChoiceObjective-mapped

Publishing Pipeline Artifacts to Azure Artifacts Only on Success

You have a build pipeline that produces several artifacts. You need to publish these artifacts to Azure Artifacts feed, but only if the build succeeds. Which task should you add to the pipeline?

Quick Answer

Publish Build Artifacts followed by a Universal Publish task is the pairing that gets build outputs into an Azure Artifacts feed: the first task exposes the build's outputs as pipeline artifacts, and Universal Publish pushes them into the feed as a Universal Package. Because pipeline tasks run in sequence and later steps only execute after earlier ones succeed, this naturally publishes only on a successful build.

⚠ Common exam trap

It's easy for candidates to assume any package-specific task (npm, NuGet) can publish to Azure Artifacts, but the question asks for publishing 'several artifacts' (not just one package type), so the Universal Publish task is the only correct choice for a generic, multi-artifact scenario.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Add a 'Publish Build Artifacts' task and then a 'Universal Publish' task.

The 'Publish Build Artifacts' task makes the build outputs available as pipeline artifacts, and the 'Universal Publish' task is the correct way to publish those artifacts to an Azure Artifacts feed (which supports Universal Packages). This combination ensures artifacts are only published after the build succeeds because both tasks run in the pipeline's job sequence, and by default, subsequent tasks execute only if the previous task succeeded.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Add a 'Publish Build Artifacts' task and then a 'Universal Publish' task.

    Why this is correct

    Correct: Publish build artifacts first, then publish to Azure Artifacts feed.

  • Add an 'npm publish' task to publish packages.

    Why it's wrong here

    npm publish is only for npm packages.

  • Add a 'Copy Files' task to copy artifacts to the feed location.

    Why it's wrong here

    Copying files does not publish to the feed.

  • Add a 'NuGet push' task to push packages to the feed.

    Why it's wrong here

    NuGet push is only for NuGet packages, not generic artifacts.

About these practice questions

Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on AZ-400

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. You are designing a build pipeline for a Java application that uses Maven. You want to publish the compiled JAR file as a build artifact. Which task should you use?

easy
  • A.PublishBuildArtifacts@1
  • B.Maven@3
  • C.ArchiveFiles@2
  • D.CopyFiles@2

Why A: The Publish Build Artifacts task publishes files as pipeline artifacts. Option B (Maven@3) is wrong because it builds the project but does not publish artifacts. Option C (ArchiveFiles@2) is wrong because it creates a zip but does not publish. Option D (CopyFiles@2) is wrong because it only copies files within the agent.

Variation 2. You are designing a build pipeline for a Java application hosted in Azure Repos. The pipeline needs to run unit tests, package the application as a JAR file, and publish the build artifact. Which task should you use to publish the JAR file as a pipeline artifact?

medium
  • A.Publish Build Artifacts task
  • B.Copy Files task
  • C.Archive Files task
  • D.Publish Pipeline Artifact task

Why D: The Publish Pipeline Artifact task (D) is the correct choice because it is the modern, recommended way to publish artifacts from a pipeline in Azure DevOps. It stores the JAR file as a pipeline artifact, making it available for subsequent stages or releases, and it supports both file and folder paths directly without requiring an intermediate staging directory.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.