How to resolve “Pipeline does not have permissions to use the referenced service connection(s)”

I’ve been caught out by this before and then have to remind myself how to fix it.

You have an Azure Devops pipeline (mine’s a YAML based pipeline). You run the pipeline and get the error message “Pipeline does not have permissions to use the referenced service connection(s) XXX” (where XX is your SPN etc.).

This is simple to fix by correctly configuring your security.

  • Go to Project Settings | Service Connections within Azure Devops
  • Filter or otherwise find the SPN that you need to add the permission to and click it
  • In the top-right corner, click the vertical “…” (kebab menu) and select the Security option
  • Scroll down to the pipeline permissions and add your pipeline to the list of permissioned pipelines using the + button