azure-devops-self-hosted-agent - Azure DevOps 服务 - 自托管代理已脱机
问题描述
为代理启动 Windows 服务时,事件日志中会记录以下错误:
Failed to create session. VS30063: You are not authorized to access https://dev.azure.com.
(Level: Error; Source: VstsAgentService)
代理使用 PAT 进行配置。Windows 服务作为网络服务运行。配置依据:https ://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
代理程序已经成功运行了数周,但有些东西破坏了我们的代理程序。当然,它随后会与某种类型的变化相关联。提前感谢任何故障排除提示。
从 中提取Agent_20200421-125954-utc.log
。
[2020-04-21 12:59:58Z INFO RSAEncryptedFileKeyManager] Loading RSA key parameters from file D:\agent5\.credentials_rsaparams
[2020-04-21 12:59:58Z INFO RSAEncryptedFileKeyManager] Loading RSA key parameters from file D:\agent5\.credentials_rsaparams
[2020-04-21 12:59:58Z INFO VisualStudioServices] AAD Correlation ID for this token request: Unknown
[2020-04-21 12:59:58Z WARN VisualStudioServices] Authentication failed with status code 401.
...
[2020-04-21 12:59:58Z ERR VisualStudioServices] POST request to https://dev.azure.com/{organization}/_apis/distributedtask/pools/1/sessions is not authorized. Details: VS30063: You are not authorized to access https://dev.azure.com.
[2020-04-21 12:59:58Z ERR MessageListener] Catch exception during create session.
[2020-04-21 12:59:58Z ERR MessageListener] Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: VS30063: You are not authorized to access https://dev.azure.com.
[2020-04-21 12:59:58Z INFO MessageListener] Non-retriable exception: VS30063: You are not authorized to access https://dev.azure.com.
[2020-04-21 12:59:58Z ERR Terminal] WRITE ERROR: Failed to create session. VS30063: You are not authorized to access https://dev.azure.com.
解决方案
有什么东西破坏了我们的特工。
由于完全不知道现在有什么变化以及代理的损坏情况如何,请提供一些可能的建议,您可以尝试一下。
去吧D:\agent5
,.credentials
用文字打开。
确保其内容如下所示:
{
"scheme": "OAuth",
"data": {
"clientId": "xxxxxx", # This are generated automatically by
"authorizationUrl": "https://vssps.dev.azure.com/{org name}/_apis/oauth2/token",
"oauthEndpointUrl": "https://vssps.dev.azure.com/{org name}/_apis/oauth2/token"
}
}
然后保存它,并尝试再次重新运行代理。
如果这种方式仍然无法使您的代理可用,或者文件包含我上面提到的内容,那么现在我猜应该是文件.credentials
损坏了。.credentials_rsaparams
.credentials_rsaparams
是一个具有 RSA 私钥的文件,用于代理和服务器之间的 OAuth 令牌交换。服务器持有公钥,每 50 分钟服务器会向代理发送一个新的令牌,该令牌由公钥加密。
它是服务器自动生成的文件,这意味着你不能手动修改它,因为你不知道你应该输入什么。
目前,您最好按照以下步骤重新配置此代理:
1)使用Run as Administrator运行Command line
/ ,然后.Powershell line
cd D:\agent5
2)运行.\config remove
。并在删除成功后执行代理配置步骤。
推荐阅读
- google-sheets - 在 GoogleFinance 中,我应该使用什么公式从特定日期获得股票的 1 周回报、2 周回报等等?
- java - 如何从多个列表中创建匹配对象列表并删除匹配列表中的对象,使其反映在原始列表中
- c# - 消息字段和消息窗口
- javascript - 在第一个函数完成将 CSS 样式应用于元素后运行 JavaScript 函数 - 回调不起作用
- python - 使用消息引发 ValueError,但不打印消息
- python - 将 ctypes 类型数组转换为 void 指针时出现 Numpy 错误
- javascript - 仅显示 localStorage 数据数组中的第一项
- jquery - 支持 jQuery 和 HTML 的 fetch 响应类型
- linux - sed:包括一个由正则表达式指定的外部文件
- java - java中的ModelMapper Class Not Found错误问题