Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot authorize variable group in Azure Pipelines

I am constructing a multi-stage Azure Pipeline in Azure DevOps to build and release my product.

I want to use variable groups in this pipeline, so that I can substitute different configuration values for different deployment environments.

I am unable to authorize my variable groups to be used by the pipeline. When I manually run a build, I see a message on the summary page telling me the variable group is not authorized: Error message

The Azure DevOps documentation says this is to be expected:

When you make changes to the YAML file and add additional resources (assuming that these not authorized for use in all pipelines as explained above), then the build fails with a resource authorization error that is similar to the following: Could not find a {RESOURCE} with name {NAME}. The {RESOURCE} does not exist or has not been authorized for use.

In this case, on the Summary page, you will see an option to authorize the resources on the failed build. If you are a member of the User role for the resource, you can select this option. Once the resources are authorized, you can start a new build.

I am a member of the User role for the variable group, and I am seeing the message, but I am presented with no option to authorize. Is there something else I need to do? Or is there another way I can authorize a specific pipeline to use a variable group?

like image 351
Peter Avatar asked Oct 10 '19 00:10

Peter


People also ask

How do you use variable groups in Azure pipelines?

To use a variable group, open your pipeline. Select Variables > Variable groups, and then choose Link variable group. In a build pipeline, you see a list of available groups. In a release pipeline, for example, you also see a drop-down list of stages in the pipeline.

How do you pass variables in Azure DevOps pipeline?

Passing variables between tasks in the same jobSet the value with the command echo "##vso[task. setvariable variable=FOO]some value" In subsequent tasks, you can use the $(FOO) syntax to have Azure Pipelines replace the variable with some value.

How do I get azure DevOps variable group ID?

In the Response of the Azure DevOps CLI( az pipelines variable-group create ), it can contain the created Variable Group ID. You can directly get the ID in the CLI response. Save this answer.


1 Answers

The provided solution proposed by @hey didn't work for me because i had to use deployment jobs. I've found a hacky way to resolve this error:

  1. Go to your pipeline
  2. Edit
  3. Click on the tree dots > Triggers
  4. Navigate to the variables tab
  5. Variable groups
  6. Add variable groups
like image 126
Frederic de smet Avatar answered Sep 24 '22 13:09

Frederic de smet