Pipeline Variables and Templates Flashcards
7 cards from real AZ-400 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Pipeline Variables and Templates flashcards as text
You want to reuse a YAML template stored in a different Azure DevOps repository. What must you configure first?
Answer: A resources.repositories reference with the repository alias
Cross-repository templates require declaring the source repo under `resources.repositories` with a `ref` and `type` before you can reference its templates.
What is the syntax to reference a variable set in a previous stage named 'Build' from job 'CompileJob' within a subsequent stage?
Answer: $[stageDependencies.Build.CompileJob.outputs['stepName.outputVar']]
Cross-stage output variable references use `$[stageDependencies.StageName.JobName.outputs['stepName.varName']]` runtime expression syntax.
Which template parameter type allows passing a sequence of arbitrary values such as a list of environment names?
Answer: object
The `object` parameter type accepts YAML sequences and mappings, making it suitable for passing lists or dictionaries to templates.
A developer sets `variables: [{name: API_URL, value: https://dev.api.com}]` at the pipeline level and also sets the same variable at the job level to a production URL. Which value is used during job execution?
Answer: The job-level value because job scope overrides pipeline scope
Job-level variable definitions override pipeline-level definitions because narrower scopes take higher precedence in Azure Pipelines.
Which Azure CLI command updates a pipeline variable to be secret after the pipeline has already been created?
Answer: az pipelines variable update --name VAR --secret true
The `az pipelines variable update --name VAR --secret true` command converts an existing pipeline variable to a secret type.
What does the `${{ variables.myVar }}` template expression return if `myVar` is a runtime-only variable set by a previous step?
Answer: An empty string, because template expressions are resolved before runtime
Template expressions (`${{ }}`) are resolved at compile/queue time, so runtime-only variables are not yet available and result in an empty string.
How can you prevent a pipeline consumer from overriding a specific template parameter at queue time?
Answer: Do not expose the value as a parameter; hardcode it inside the template
Hardcoding values inside a template rather than exposing them as parameters prevents consumers from overriding those values.