Microsoft DevOps Engineer Expert AZ-400 Practice Question
You are standardizing your organization's Azure Pipelines by extracting a frequently used job into a reusable YAML template named build-dotnet.yml. The job relies on values that different teams keep in their own variable groups. You want the calling pipeline to decide at queue time which variable group the template should import, without having to modify the template itself for every team.
Which approach should you implement inside build-dotnet.yml so that the same template can be reused with any variable group name chosen by the caller?
Read the group name from a secure environment variable that each team sets on the agent machine.
Declare a string parameter such as parameters: - name: varGroupName and import the group with variables:
group: ${{ parameters.varGroupName }}
Reference the variable group name through a runtime variable like $(varGroupName) inside the variables section.
Convert the job into a task group instead of a YAML template and set the variable group as a task group parameter.
A template can expose a string parameter that the consuming pipeline sets to the name of its preferred variable group. Inside the template you reference that parameter in the variables section by using compile-time expression syntax. When the caller provides a different value for that parameter, the variable-group reference is replaced at template expansion, allowing the same template to work with any variable group. Referencing the variable group through a runtime variable such as $(varGroup) or environment variables will not work because the group name must be resolved before the pipeline is run. Task group parameters and predefined system variables cannot be used to inject an arbitrary variable-group name.
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 compile-time expression syntax (${{ }}) necessary for this solution?
Open an interactive chat with Bash
What is the difference between using a YAML template and a task group for this scenario?
Open an interactive chat with Bash
Why can't variable-group names be set using runtime or environment variables?
Open an interactive chat with Bash
What is a YAML template, and why is it used in Azure Pipelines?
Open an interactive chat with Bash
What is the difference between compile-time and runtime in Azure Pipelines?
Open an interactive chat with Bash
Why can’t task group parameters or system variables inject variable-group names?
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 .