Jason G.
Jason G.

Reputation: 810

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)'

Upvotes: 12

Views: 32028

Answers (4)

tomwaitforitmy
tomwaitforitmy

Reputation: 729

The question does not really state if you are dealing with Azure DevOps Services or with Azure DevOps Server. With Server this did the trick for me:

pool:
  name: 'myPoolName'

Upvotes: 4

CervEd
CervEd

Reputation: 4272

This worked in my enviroment

pool:
  name: default

Upvotes: 13

Jorn.Beyers
Jorn.Beyers

Reputation: 2054

I had the same issue for 'Azure Pipelines'. It turned out that the project did not had Azure Pipelines pool added in the Agent pools. You can configure this in Azure DevOps at the Project Settings. (gear icon bottom left)

enter image description here

Upvotes: 11

4c74356b41
4c74356b41

Reputation: 72191

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.

Upvotes: 4

Related Questions