Microsoft DevOps Engineer Expert AZ-400 Practice Question
A build pipeline that runs on Microsoft-hosted Linux agents restores about 300 MB of Maven dependencies from the public Maven Central repository on every execution. The team complains about long queue-to-publish times and the organization wants to reduce egress traffic charges. You must implement a change that
shortens the pipeline run time,
minimizes repeated network downloads,
automatically refreshes the stored files when the project's pom.xml changes,
requires no manual maintenance of the agent machines. Which action should you take?
Add a Cache@2 task that stores the local Maven repository using a key based on the SHA-1 hash of pom.xml.
Publish the .m2 directory as a pipeline artifact in the first stage and download it in later stages of every run.
Switch the pipeline to use the ubuntu-latest image, which includes more pre-installed build tools and caches.
Commit the entire .m2 directory to the Git repository using Git LFS so agents can clone the dependencies.
Using the Cache task creates a pipeline-managed cache on the agent pool. The key can include a hash of pom.xml so the cache is automatically invalidated when dependencies change. Subsequent jobs on any Microsoft-hosted agent will download the cache from Azure Storage instead of Maven Central, greatly reducing run time and egress cost while requiring no agent customization. Pipeline artifacts are intended for sharing outputs between jobs or runs and do not provide automatic invalidation, Git LFS would bloat the repository and increase storage cost, and selecting a different hosted image does not guarantee the required dependencies will be pre-installed.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why is using Cache@2 task more efficient than using pipeline artifacts for this scenario?
Open an interactive chat with Bash
What is the role of SHA-1 hashing in the Cache@2 task?
Open an interactive chat with Bash
Why is switching to the ubuntu-latest image an incorrect solution?
Open an interactive chat with Bash
What is a Cache@2 task in Azure DevOps pipelines?
Open an interactive chat with Bash
How does using the SHA-1 hash of pom.xml improve caching?
Open an interactive chat with Bash
What is the impact of egress traffic charges in pipeline operations?
Open an interactive chat with Bash
Microsoft DevOps Engineer Expert AZ-400
Design and implement build and release pipelines
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .