AZ-400 Practice Question: Design and implement build and release pipelines
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?
⚠ Common exam trap
It's easy for candidates to confuse the legacy Publish Build Artifacts task (A) with the modern Publish Pipeline Artifact task (D), not realizing that the latter is the recommended approach in current Azure DevOps pipelines and offers better performance and integration.
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
✓
Publish Pipeline Artifact task
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.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Publish Build Artifacts task
Why it's wrong here
Publish Build Artifacts is the legacy build-artifact task intended for classic build/release pipelines; it stores artifacts under the build artifact container rather than the modern pipeline artifact store. Although it can be invoked from a YAML pipeline, it does not expose the same consumption model as Publish Pipeline Artifact for multi-stage YAML pipelines, and Azure DevOps guidance recommends migrating to Publish Pipeline Artifact. Using it here would be technically functional but not the correct, modern choice.
- ✗
Copy Files task
Why it's wrong here
Copy Files is a file-utility task that copies files from a source pattern to a destination folder on the agent's local file system, such as a staging or drop directory. It performs no upload to Azure Pipelines, creates no artifact record, and does not make the copied files available to other stages or jobs. The copied files exist only on the ephemeral agent's disk, so a separate publish step is always required to share them downstream.
- ✗
Archive Files task
Why it's wrong here
Archive Files compresses one or more files or directories into a single .zip or other archive file on the agent's filesystem. While this can be a useful preparatory step for packaging, it does not transfer that archive to Azure Pipelines or associate it with the pipeline run as an artifact. Without an explicit publish action, the archive remains local to the agent and is unavailable to subsequent stages; the archiving task itself is therefore insufficient.
- ✓
Publish Pipeline Artifact task
Why this is correct
Publish Pipeline Artifact uploads files, directories, or archives to Azure Pipelines' pipeline artifact storage, making them downloadable and consumable by later stages in the same pipeline. It is the modern, YAML-native artifact-publishing task, and by default subsequent stages automatically download published pipeline artifacts into the Pipeline.Workspace directory. This is the correct task when the goal is to pass build outputs from a Java build stage to later deployment or test stages.
Visual reference
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
Azure DevOps
Azure DevOps is a Microsoft service that provides development tools for planning, building, testing, and deploying software applications using automated pipelines and collaboration features.
Key term
Artifact
An artifact is any file or package produced during the software development process that is used to deploy, test, or run an application.
About these practice questions
One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
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.