azure - 无法将 VM 资源添加到 Azure DevOps 环境
问题描述
我按照步骤将 VM 资源添加到环境中,但在运行脚本时出错。我搜索了错误消息,但找不到任何东西。
错误信息:Failed to add virtual machine resource. Linked environment pool is null.
日志文件有这些:
[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 的组织管理员,并在本地 VM 上以服务器管理员的身份运行脚本。
更新
使用--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
我发现其他人也有相同或相似的问题。
解决方案
推荐阅读
- amazon-kinesis - localstack Kinesis 不在 docker 中启动
- css - 如何从 Internet Explorer 中的打印页面中删除页眉和页脚
- java - 如何分隔数组开头的名称?
- java - 不可变类的存储区域
- php - PHP IF 语句要使用 Else If 还是另一个 IF 语句?
- python-3.x - 如何使用 python 运行管理命令提示符?
- dask - dask read_parquet 内存不足
- spring-boot - Spring Boot JPA find, filter
- javascript - 如何在VSC中快速找到TS函数的来源而不需要手动通过node_modules?
- ios - SwiftUI 中的 $varName 和 _varName 有什么区别