Search code examples
azureazure-devopsazure-devops-self-hosted-agent

Azure Devops Selfhosted Agent


There was a resource authorization issue: 'The pipeline is not valid. Could not find a pool with the name v1Agent. The pool does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.'

It seems like i have successfully set up the Selfhost Agent. On the interface, I can see that it's active, and on my machine, I can confirm that it's running as a Windows service. However, when I try to use it, I encounter the following error:

yaml:

trigger:
- main

pool: v1Agent

variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package 
                  /p:PackageAsSingleFile=true 
                  /p:SkipInvalidConfigurations=true 
                  /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Solution

  • Make sure the name of the pool is the name of the pool - not the agent.

    Here is an example snippit for a pool named Self Hosted Pool

    trigger: main
    
    pool: Self Hosted Pool
    
    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'
    

    enter image description here