azure - 无法将 VM 资源添加到 Azure DevOps 环境

标签 azure azure-devops

我关注了steps将虚拟机资源添加到环境中,但运行脚本时出现错误。我搜索了错误消息,但没有找到任何内容。

错误消息:添加虚拟机资源失败。链接环境池为空。

日志文件包含以下内容:

[2021-10-18 23:03:25Z ERR  VisualStudioServices] POST request to https://dev.azure.com/xxx/guid/_apis/pipelines/environments/3/providers/virtualmachines failed. HTTP Status: InternalServerError, AFD Ref: Ref A: guid Ref B: WSTEDGE0610 Ref C: 2021-10-18T23:03:25Z
[2021-10-18 23:03:25Z INFO CommandSettings] Flag 'unattended': 'False'
[2021-10-18 23:03:25Z ERR  Terminal] WRITE ERROR (exception):
[2021-10-18 23:03:25Z ERR  Terminal] Microsoft.TeamFoundation.DistributedTask.WebApi.VirtualMachineResourceLinkedPoolNullException: Failed to add virtual machine resource. Linked environment pool is null. 
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider.AddAgentAsync(AgentSettings agentSettings, TaskAgent agent, CommandSettings command)
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command)
[2021-10-18 23:03:25Z ERR  Terminal] WRITE ERROR: Failed to add the agent.  Try again or ctrl-c to quit

配置命令基本上如下:

config --environment --environmentname DEV --agent computername --runasservice --work _work --url https://dev.azure.com/xxx/--projectname myprojectname --auth PAT -- token xxx

我是 DevOps 的组织管理员,并以服务器管理员身份在本地虚拟机上运行脚本。

更新

使用--unattanded选项后:

config --unattanded --disableloguploads --environment --environmentname DEV --pool org-agent-pool-nm --agent computername --runasservice --windowsLogonAccount xxx --windowsLogonPassword xxx --work _work - -url https://dev.azure.com/xxx/--projectname myprojectname --auth PAT --token xxx

我遇到了不同的错误。

Flag 'unattended': 'True' 
Failed to add virtual machine resource. Linked environment pool is null. 

更新2

我发现其他人也有相同或类似的问题。

Azure Devops Pipeline Environment Resource Agent installation issue

https://developercommunity.visualstudio.com/t/addition-of-resource-to-environment-fails-for-user/1048111

最佳答案

  • 查看部署池权限。
  • 您需要拥有该池的权限,您的计算机正在其中寻找该池。
  • 如果您没有权限,您将会看到上述问题。
  • 获得权限后,您就可以查看部署池名称。

关于azure - 无法将 VM 资源添加到 Azure DevOps 环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69623639/

相关文章:

c# - Azure函数通过clientRetryOptions和host.json进行队列绑定(bind)重试不起作用

powershell - Azure DevOps 的 PowerShell 任务中是否提供管道变量?

git - 我如何在 AzureDevOps 存储库中实现/设置 GitFlow,并在 master 和 develop 上使用 PR 分支策略?

azure - Microsoft 托管代理上的 Az powershell 模块可用性

azure - 如何使用 Node.js 在 MSAL 的帮助下获取 Azure DevOps PAT 列表

reactjs - Azure IIS 重写中的 React 路由器

Azure 容器服务 (AKS) - 将容器公开给其他 VNET 资源

azure - 能够通过电子邮件向外部用户发送工作项目(史诗、错误、用户故事等)

azure - 当对 Linux Web 应用程序使用 Azure DevOps CI/CD 时,如何将构建工件压缩并仅作为 zip 文件发布,而不是复制到目录

azure - 端点 Webhook URL 上的事件网格订阅 ARM 部署失败