Search code examples
azure-devopsazure-pipelinesazure-devops-self-hosted-agent

Error when trying to set pipeline pool to Default agent pool using azure-pipelines.yml


I followed the documentation for setting pool via Pipelines Schema Docs and set it as such pool: Default. This should direct pipelines to use the Default pool:

Default agent pool under All agent pools in dev-ops UI

However, I keep getting this error:

Could not find a pool with name Default. The pool does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.

Could not find a pool with name Default. The pool does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.

As far as I can tell it should be authorized.

I also tried:

pool:
  name: Default

Full azure-pipelines.yml

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core

name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)

trigger:
  batch: true
  branches:
    include:
    - master
    - develop

pool: Default

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

steps:
- task: NuGetToolInstaller@0

- 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:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

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

Solution

  • You can refer to this link: https://aka.ms/yamlauthz to fix this issue ;)

    Try changing your branch to any other branch and saving your pipeline and changing it back and saving it. Run pipeline after that.

    To accomplish this click on Edit on the top right of the Pipelines/Build page. You will be presented with the YAML editing tool. Now click the hamburger icon on the top right and select Variables. This will take you to the classic editor. From the classic editor click on the YAML tab. Under the YAML tab you can select Get sources and change you default branch.