How to Use Variable Groups in Azure DevOps

Variable groups in Azure DevOps give pipelines a shared place to read configuration. The key is deciding what to share, what to scope to an environment, and which pipelines should be allowed to use secrets. A single group for every setting tends to recreate the problem in a different place.

You’ll learn how to create variable groups, scope them to YAML stages, link secrets from Azure Key Vault, and troubleshoot configuration and permission failures before a production deployment.

Plan Variable Groups in Azure DevOps Around Environments

A variable group is a named collection of key-value settings in an Azure DevOps project’s Pipeline Library. Multiple pipelines can reference the same group without duplicating settings in each YAML file. That makes changes easier to manage, but it also means one Library edit can affect several releases without changing any application code.

For an employee portal hosted on Azure App Service, start with these boundaries:

Variable groupExample variablesWhere to use it
vg-employee-portal-sharedApplicationNameEvery stage that needs the same nonsecret value
vg-employee-portal-devAzureResourceGroup, WebAppNameDevelopment stage only
vg-employee-portal-prod