Question 879 of 823
Freeing Disk Space on a Self-Hosted Agent After Every Build
Your build pipeline uses a self-hosted agent. The agent is running low on disk space. You need to clean up the agent's working directory after each build. Which option should you configure in the pipeline?
Quick Answer
Setting clean: true (or clean: all) on the YAML checkout step is the native, built-in way to purge the working directory on a self-hosted agent — it instructs the agent to delete the sources directory as part of checkout, directly addressing low disk space without needing any additional marketplace task.
⚠ Common exam trap
Test-takers frequently confuse the classic pipeline 'Clean' setting (which is a pre-build option) with the YAML `clean` parameter (which can be configured to run after the build), leading them to incorrectly select Option A.
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
✓
Use the 'clean' parameter in the checkout step of the YAML pipeline.
The `clean` parameter in the YAML checkout step is the native, built-in way to instruct the agent to delete the sources directory before or after the build. Setting `clean: true` or `clean: all` ensures the working directory is purged, directly addressing the low disk space issue without requiring additional tasks or marketplace extensions.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Set the 'Clean' option to 'Sources' in the pipeline settings.
Why it's wrong here
Refers to the classic pipeline 'Clean' setting, which is available under Get Sources but only cleans before the build, not after. The question implies a YAML pipeline (since the correct answer uses the YAML 'clean' parameter), and for YAML pipelines, the clean parameter in the checkout step is the appropriate way to clean the working directory after each build.
- ✗
Add a 'Delete Files' task at the end of the pipeline to delete the sources directory.
Why it's wrong here
This would delete after build, not before, and doesn't free space during build.
- ✗
Add a 'Cleanup' task from the marketplace to clean the agent.
Why it's wrong here
Not a built-in task; unnecessary complexity.
- ✓
Use the 'clean' parameter in the checkout step of the YAML pipeline.
Why this is correct
Correct: 'clean: true' cleans the working directory before checkout.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way 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. Your Azure DevOps project uses a self-hosted agent pool. Users report that builds are randomly failing with a 'disk full' error. The agents have 50 GB of disk space. What is the most effective way to mitigate this issue?
hard- A.Add more agents to the pool
- B.Use the 'Clean all build directories' option in the agent configuration
- ✓ C.Enable the 'Clean after build' option on the build pipeline
- D.Set 'Maximum number of parallel jobs' to 1
Why C: Enabling 'Clean after build' ensures workspace cleanup after each run, reclaiming disk space to prevent failures. Option A is wrong because adding more agents doesn't free disk space on existing agents. Option B is wrong because 'Clean all build directories' cleans before builds, which may not prevent mid-build disk full errors and can disrupt parallel builds. Option D is wrong because limiting parallel jobs doesn't free disk space; a single build can still consume all available disk space.
Last reviewed: Jul 4, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.