Courseiva
Design and implement build and release pipelineshardMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement build and release pipelines

Your company uses Azure DevOps for CI/CD. You have a YAML build pipeline that builds a .NET Core application and publishes artifacts. The build runs on a Microsoft-hosted agent. Recently, the build started failing with the error 'The process cannot access the file because it is being used by another process.' This occurs intermittently during the 'dotnet build' step. The pipeline uses multiple jobs that run in parallel. You suspect that one job is interfering with another because they share the same workspace on the agent. You need to ensure that each job runs in its own isolated workspace. What should you do?

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

Set 'clean: all' on the checkout step in each job.

Setting 'clean: all' on the checkout step ensures that the workspace is cleaned before each job runs, preventing file conflicts caused by shared workspace on the agent. Option A is wrong because 'demands' are for selecting agents with specific capabilities, not for workspace isolation. Option B is wrong because 'workspace: clean' is not a valid setting at the pipeline root; workspace cleaning is configured per checkout step. Option C is wrong because a multi-job configuration with a matrix is used for parallelizing builds across different configurations, not for isolating workspaces.

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 'demands' section to the job to ensure each job runs on a different agent.

    Why it's wrong here

    Demands only filter which agents have the required capabilities, but they do not isolate jobs from each other on the same agent. Multiple jobs can still run sequentially on the same agent and share the same workspace, so leftover files from prior jobs can cause interference.

  • Set 'workspace: clean' in the pipeline root.

    Why it's wrong here

    `workspace` is not a valid root-level key in an Azure Pipelines YAML schema. The pipeline root supports keys such as `trigger`, `pool`, `variables`, and `jobs`, but workspace cleanup is configured either via the job-level `workspace.clean` property (e.g., `workspace: clean: all`) or via the `clean` parameter on each `checkout` step. Setting `workspace: clean` at the pipeline root would cause a schema validation error, and even if it were somehow accepted, it would not override per-step or per-job cleanup settings. The correct fix is to add `clean: all` to the checkout step in every job, not to set `workspace` at the pipeline root.

  • Use a 'multi-job' configuration with a matrix to run each job in separate folders.

    Why it's wrong here

    A matrix strategy creates multiple job instances, but by default they all run in the same agent workspace unless you explicitly set a separate workspace directory for each job. Without that, they share the same checkout folder, so a matrix does not solve the problem of leftover files.

  • Set 'clean: all' on the checkout step in each job.

    Why this is correct

    Setting `clean: all` on the checkout step in each job is the correct fix because it deletes the entire workspace, including all files from previous jobs, before the repository is checked out. This guarantees a fresh, isolated environment for every job, preventing stale artifacts from affecting the build.

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 →

How Courseiva writes practice questions · Editorial policy

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.