Bitzu

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

Single choice

Which YAML snippet links a variable group named shared-config to a pipeline?

  1. variables: - group: shared-config
  2. variables: - name: group value: shared-config
  3. resources: - variableGroup: shared-config
  4. 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.

Select all that apply

Which statements about variable groups in Azure Pipelines are correct?

  1. A YAML pipeline must be authorized before it can use a group
  2. Secret variables in a group can be protected with approvals and checks
  3. Approvals and checks also restrict the non-secret variables of a group
  4. With duplicate names across groups, the first group listed wins
  5. 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

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.

Download on the App StoreGet it on Google Play

More AZ-400 topics in this module