2

Is there an IConfiguration provider for Azure Devops pipeline variables?

I googled this for about 15 minutes but could not find anything.

We have a series of net5.0 projects with corresponding unit and integrations tests that rely in pipeline variables as follows:

  • Tests use an IConfigurationBuilder, including environment variables
  • Variables are added to an Azure Devops Pipeline
  • Modify the pipeline yaml to map the pipeline variables to environment variables

This is fairly straight forward. For each configuration setting that needs to be driven by a pipeline variable, we:

I'd prefer to do something like:

var config = new ConfigurationBuilder()
  .AddEnvironmentVariables(...)
  .AddPipelineVariables(...)  // considering writing this; don't what to reinvent the wheel

and skip the modifications to the pipeline yaml.

Eric Patrick
  • 2,097
  • 2
  • 20
  • 31
  • You could try it with [Runtime parameters](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters?view=azure-devops&tabs=script), then you could change the value before run the build. – Carlos Feb 01 '21 at 09:31

0 Answers0