Search code examples
azure-devopsazure-pipelinesazure-service-principal

Can't add a Service Principal to a self-hosted agent pool


I'm trying to add a new windows self-hosted build agent following this guide: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/service-principal-agent-registration?view=azure-devops

When I attempt to add a service principal account, already created as a basic user at the organization level, to my build agent pool in my project the service principal does not appear in the list of accounts. I typed the name of the service principal in the "add user" pop-up. It said "No identities found". I expected it to show the service principal since I followed the instrucitons here: https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/service-principal-managed-identity?view=azure-devops#2-add-and-manage-service-principals-in-an-azure-devops-organization Adding Service Principal

Organization User

How can I give the service principal the administrator permission on the pool?


Solution

  • I can reproduce the same when adding SP to agent pool even all permission is correct.

    It could be a regression as it worked before. It's recommended to track on the existing community link.

    As a workaround, you can create a user group, add the SP as a member of the group. On organization setting -> agent pool -> add the group as administrator role(if you add from project level, it won't work).

    enter image description here

    If the group is not added, permission limited for SP:

    enter image description here

    If the group is added, with SP, it works.

    enter image description here