I have multiple agent pools that require a pipeline to request authorization.
When I assign a hardcoded value like pool: STAGING
to the pipeline, it stops and asks for authorization.
⚠️ This pipeline needs permission to access a resource before this run can continue to Update environments View
However, when I inject the pool name to the pipeline as a runtime variable, for example as part of a matrix strategy like this:
- job: update
strategy:
matrix:
dev:
poolName: 'DEV'
stg:
poolName: 'STAGING'
maxParallel: 2
pool: $(pool)
It fails, with the authorization error:
##[error]Pipeline does not have permissions to use the referenced pool(s) AWS_STG_02_RELEASE.
For authorization details, refer to https://aka.ms/yamlauthz.
But there's no prompt to authorize.
In Azure DevOps Services
For dynamically assigned pools you'll need to grant the pipeline access to the pool from the pool's configuration instead:
From the docs referenced in the URL that's mentioned in the logs:
In Azure DevOps Server
Unfortunately, this feature hasn't made it into Azure DevOps Server yet (last version checked: 2022.0). I do suspect the REST API exists under the hood.
You could try approving the pipeline by updating the agent pool permissions:
The
id
being passed in is theid
of the pipeline definition.