Azure DevOps Services-自托管代理已脱机

时间:2020-04-21 13:35:45

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

为代理启动Windows服务时,在事件日志中记录以下错误:

Failed to create session. VS30063: You are not authorized to access https://dev.azure.com.
(Level: Error; Source: VstsAgentService)

使用PAT对代理进行配置。 Windows服务作为网络服务运行。 根据{{​​3}}

配置

代理已成功运行了几周,但发生了一些事情使我们的代理损坏的情况。当然,之后它将与某种类型的更改相关。在此先感谢您提供任何疑难解答提示。

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.

1 个答案:

答案 0 :(得分:1)

某些事情破坏了我们的代理商。

由于现在完全不知道代理的变化以及代理的坏处,因此请给出一些可能的建议,您可以尝试一下。

转到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分钟将新令牌发送给由公钥加密的代理。

这是服务器自动生成的文件,这意味着您不知道应该输入什么内容,因此无法手动对其进行修改。

目前,您最好遵循以下steps重新配置此代理程序:

1),先使用以管理员身份运行,然后再运行Command line,运行Powershell line / cd D:\agent5

2)运行.\config remove。删除成功后,请执行代理配置步骤。