AZ-400 ยท Reusable pipelines and approvals
Variable groups and the Library
Pipeline, system and predefined variables, variable groups and Library, linking Key Vault, secret variables, runtime parameters, GitHub Actions variables, secrets and environment scoping.
Key points
- Variable group (Pipelines > Library): values and secrets shared across pipelines.
- YAML: variables: - group: name; the pipeline must be authorized. Classic pipelines need no separate authorization.
- Secret variables are protected resources: approvals and checks can guard them.
- Azure Key Vault link: secrets fetched at run time.
- Same name in two groups: the last one listed wins.
Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/library/variable-groups?view=azure-devops
Practice questions
Which YAML snippet links a variable group named shared-config to a pipeline?
- variables: - group: shared-config
- variables: - name: group value: shared-config
- resources: - variableGroup: shared-config
- parameters: - group: shared-config
Show answer
Answer: A. variables: - group: shared-config
Groups are referenced under variables with the group key. Plain name/value entries define standalone variables, and template is for template files.
Which statements about variable groups in Azure Pipelines are correct?
- A YAML pipeline must be authorized before it can use a group
- Secret variables in a group can be protected with approvals and checks
- Approvals and checks also restrict the non-secret variables of a group
- With duplicate names across groups, the first group listed wins
- Classic pipelines need a separate per-pipeline authorization step
Show answer
Answer: A. A YAML pipeline must be authorized before it can use a group, B. Secret variables in a group can be protected with approvals and checks
YAML pipelines need explicit authorization, and secret variables in a group are protected resources that accept approvals and checks. Non-secret variables are not limited by checks, and with duplicate names the last group listed wins, not the first.
True or false: a secret variable from a variable group is automatically available to every script step as an environment variable.
Show answer
Answer: False
False. Secret variables, including Key Vault ones, are not directly accessible in scripts; you must pass them explicitly, for example as a task argument or an explicit env mapping, which keeps their use deliberate.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
