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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →