Skip to content
Latchkey

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.

Azure DevOps
##[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.

azure-pipelines.yml
resources:
  repositories:
    - repository: templates
      type: git
      name: Platform/shared-templates
      ref: refs/heads/main

Grant the build service read on the repo

  1. Open the other repository, Settings, Repositories, Security.
  2. Grant the project build service identity Read.
  3. 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.

Frequently asked questions

What causes ""not authorized to use the repository""?
A repo declared under resources.repositories is a protected resource; the pipeline must be granted permission to use it.
How do I fix "not authorized to use the repository"?
Add the repo under resources.repositories, then approve the resource-authorization prompt on the first run.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card