尝试使用azure-pipelines.yml将管道池设置为默认代理池时出错

时间:2019-03-29 19:23:45

标签: azure-devops azure-pipelines azure-devops-self-hosted-agent

我遵循了通过Pipelines Schema Docs设置池的文档 并将其设置为pool: Default。这应该指导管道使用默认池:

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

但是,我不断收到此错误:

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.

  

找不到名称为Default的池。该池不存在或尚未被授权使用。有关授权的详细信息,请参阅https://aka.ms/yamlauthz

据我所知应该被授权。

我也尝试过:

pool:
  name: Default

完整的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://docs.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)'

2 个答案:

答案 0 :(得分:2)

您可以参考以下链接:https://aka.ms/yamlauthz来解决此问题;)

尝试将分支更改为任何其他分支,然后保存管道,然后将其更改回并保存。之后运行管道。

要完成此操作,请单击“管道/构建”页面右上角的“编辑”。您将看到YAML编辑工具。现在,单击右上角的汉堡包图标,然后选择变量。这将带您进入经典编辑器。在经典编辑器中,单击“ YAML”选项卡。在YAML标签下,您可以选择获取来源并更改默认分支。

答案 1 :(得分:0)

我对“ Azure Pipelines”也有同样的问题。事实证明,该项目未在代理程序池中添加Azure管道池。您可以在Azure DevOps的“项目设置”中进行配置。 (齿轮图标左下方)

enter image description here