Azure Pipelines repository resource "not authorized to use"
A resources.repositories entry references a repo the pipeline may not use yet. Like service connections, an external or protected repository is a resource the pipeline must be authorized for before checkout.
What this error means
The run fails with the pipeline is not authorized to use the repository X or stops on a "waiting" resource-authorization prompt for the repository.
##[error]The pipeline is not authorized to use the repository 'shared-templates'.
Grant access to continue.Common causes
The repository resource is not authorized
A repo declared under resources.repositories is a protected resource; the pipeline must be granted permission to use it.
The build service lacks read on the repo
Even when authorized as a resource, the project build service identity may not have read permission on the other repository.
How to fix it
Declare and authorize the repository resource
Add the repo under resources.repositories, then approve the resource-authorization prompt on the first run.
resources:
repositories:
- repository: templates
type: git
name: Platform/shared-templates
ref: refs/heads/mainGrant the build service read on the repo
- Open the other repository, Settings, Repositories, Security.
- Grant the project build service identity Read.
- Re-run; checkout of the resource repo now succeeds.
How to prevent it
- Declare cross-repo dependencies under
resources.repositories. - Authorize the repository resource on first use.
- Grant the build service read on every repo the pipeline checks out.