【问题标题】:Azure DevOps deployment agent can't connect due to SSL issues由于 SSL 问题,Azure DevOps 部署代理无法连接
【发布时间】:2022-06-18 12:55:03
【问题描述】:

由于 SSL 问题,Azure 部署代理几天后无法工作。

我有几台服务器无法再连接到 Azure DevOps。

我发现以下博客应该启用 tls 1.2。

https://devblogs.microsoft.com/visualstudio/azure-devops-requires-tls-1-2-on-all-connections-including-visual-studio/

我检查了我们是否启用了正确的安全协议。

C:\azagent\A2> [System.Net.ServicePointManager]::SecurityProtocol
Ssl3, Tls, Tls12

我还按照以下步骤确保在 Windows 寄存器中启用了 TLS。我手动添加了值,因为有些值不存在。

Path                                                                                          Name                        Value
----                                                                                          ----                        -----
HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319                                 SystemDefaultTlsVersions    1
HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319                                 SchUseStrongCrypto          1
HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319                                             SystemDefaultTlsVersions    1
HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319                                             SchUseStrongCrypto          1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server    Enabled                     1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server    DisabledByDefault           0
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client    Enabled                     1
HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client    DisabledByDefault           0

我在下面发布了日志,因为我不知道发生了什么。还有人知道吗?

日志:

[2022-02-05 18:38:37Z INFO AgentProcess] Agent package win-x64.
[2022-02-05 18:38:37Z INFO AgentProcess] Running on Windows (X64).
[2022-02-05 18:38:37Z INFO AgentProcess] RuntimeInformation: Microsoft Windows 6.3.9600.
[2022-02-05 18:38:37Z INFO AgentProcess] Version: 2.198.2
[2022-02-05 18:38:37Z INFO AgentProcess] Commit: d1b85881abfe7b5e575af095daf0ee27e099b904
[2022-02-05 18:38:37Z INFO AgentProcess] Culture: nl-NL
[2022-02-05 18:38:37Z INFO AgentProcess] UI Culture: en-US
[2022-02-05 18:38:37Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:37Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:37Z INFO AgentProcess] Validating directory permissions for: 'C:\azagent\A2'
[2022-02-05 18:38:37Z INFO PowerShellExeUtil] Generation: '1'
[2022-02-05 18:38:37Z INFO PowerShellExeUtil] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine', value name 'PowerShellVersion': '2.0'
[2022-02-05 18:38:37Z INFO PowerShellExeUtil] Unsupported version. Skipping.
[2022-02-05 18:38:37Z INFO PowerShellExeUtil] Generation: '3'
[2022-02-05 18:38:37Z INFO PowerShellExeUtil] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine', value name 'PowerShellVersion': '4.0'
[2022-02-05 18:38:37Z INFO PowerShellExeUtil] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine', value name 'ApplicationBase': 'C:\Windows\System32\WindowsPowerShell\v1.0'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework', value name 'InstallRoot': 'C:\Windows\Microsoft.NET\Framework64\'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'SOFTWARE\Microsoft\NET Framework Setup\NDP' contains sub keys:
[2022-02-05 18:38:37Z INFO AgentProcess]  'CDF'
[2022-02-05 18:38:37Z INFO AgentProcess]  'v2.0.50727'
[2022-02-05 18:38:37Z INFO AgentProcess]  'v3.0'
[2022-02-05 18:38:37Z INFO AgentProcess]  'v3.5'
[2022-02-05 18:38:37Z INFO AgentProcess]  'v4'
[2022-02-05 18:38:37Z INFO AgentProcess]  'v4.0'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727', value name 'Version': '2.0.50727.4927'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727', value name 'Install': '1'
[2022-02-05 18:38:37Z INFO AgentProcess] Testing directory: 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727'
[2022-02-05 18:38:37Z INFO AgentProcess] Found version: 2.0.50727
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0', value name 'Version': '3.0.30729.4926'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0', value name 'Install': '1'
[2022-02-05 18:38:37Z INFO AgentProcess] Testing directory: 'C:\Windows\Microsoft.NET\Framework64\v3.0'
[2022-02-05 18:38:37Z INFO AgentProcess] Found version: 3.0
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5', value name 'Version': '3.5.30729.4926'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5', value name 'Install': '1'
[2022-02-05 18:38:37Z INFO AgentProcess] Testing directory: 'C:\Windows\Microsoft.NET\Framework64\v3.5'
[2022-02-05 18:38:37Z INFO AgentProcess] Found version: 3.5
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4', value name 'Version' is null.
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4', value name '' is null.
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4' contains sub keys:
[2022-02-05 18:38:37Z INFO AgentProcess]  'Client'
[2022-02-05 18:38:37Z INFO AgentProcess]  'Full'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client', value name 'Version': '4.8.03761'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client', value name 'Install': '1'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client', value name 'InstallPath': 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client', value name 'Release': '528049'
[2022-02-05 18:38:37Z INFO AgentProcess] Type is System.Int32
[2022-02-05 18:38:37Z INFO AgentProcess] Interpreted version: 4.7.0
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', value name 'Version': '4.8.03761'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', value name 'Install': '1'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', value name 'InstallPath': 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\'
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', value name 'Release': '528049'
[2022-02-05 18:38:37Z INFO AgentProcess] Type is System.Int32
[2022-02-05 18:38:37Z INFO AgentProcess] Interpreted version: 4.7.0
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0', value name 'Version' is null.
[2022-02-05 18:38:37Z INFO AgentProcess] Key name 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0', value name '': 'deprecated'
[2022-02-05 18:38:37Z INFO AgentProcess] Found 5 versions:
[2022-02-05 18:38:37Z INFO AgentProcess]  2.0.50727
[2022-02-05 18:38:37Z INFO AgentProcess]  3.0
[2022-02-05 18:38:37Z INFO AgentProcess]  3.5
[2022-02-05 18:38:37Z INFO AgentProcess]  4.7.0
[2022-02-05 18:38:37Z INFO AgentProcess]  4.7.0
[2022-02-05 18:38:37Z INFO AgentProcess] Testing for min NET Framework version: '4.5'
[2022-02-05 18:38:37Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:37Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO CommandSettings] Configure {
  "AcceptTeeEula": false,
  "AddDeploymentGroupTags": false,
  "AddEnvironmentVirtualMachineResourceTags": false,
  "AddMachineGroupTags": false,
  "AlwaysExtractTask": false,
  "Agent": "IIS18",
  "CollectionName": null,
  "DeploymentGroup": false,
  "DeploymentGroupName": null,
  "DeploymentGroupTags": null,
  "DeploymentPool": false,
  "DeploymentPoolName": null,
  "EnvironmentVMResource": true,
  "EnvironmentName": "Logic4-Next - Production",
  "EnvironmentVMResourceTags": null,
  "GitUseSChannel": false,
  "DisableLogUploads": false,
  "MachineGroup": false,
  "MachineGroupName": null,
  "MachineGroupTags": null,
  "MonitorSocketAddress": null,
  "NotificationPipeName": null,
  "NotificationSocketAddress": null,
  "NoRestart": false,
  "OverwriteAutoLogon": false,
  "Pool": null,
  "ProjectName": "Logic4Desktop",
  "ProxyPassword": null,
  "ProxyUserName": null,
  "ProxyUrl": null,
  "Replace": false,
  "RunAsAutoLogon": false,
  "RunAsService": true,
  "RunOnce": false,
  "PreventServiceStart": false,
  "SslCACert": null,
  "SslClientCert": null,
  "SslClientCertArchive": null,
  "SslClientCertKey": null,
  "SslClientCertPassword": null,
  "SslSkipCertValidation": false,
  "Url": "https://dev.azure.com/organization/",
  "WindowsLogonAccount": null,
  "WindowsLogonPassword": null,
  "Work": "_work",
  "Auth": "PAT",
  "LaunchBrowser": false,
  "Password": null,
  "Token": "***",
  "Unattended": false,
  "UserName": null,
  "Help": false,
  "Version": false
}
[2022-02-05 18:38:38Z INFO AgentProcess] Arguments parsed
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'Proxy': 'C:\azagent\A2\.proxy'
[2022-02-05 18:38:38Z INFO VstsAgentWebProxy] No proxy setting found.
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'Certificates': 'C:\azagent\A2\.certificates'
[2022-02-05 18:38:38Z INFO AgentCertificateManager] No certificate setting found.
[2022-02-05 18:38:38Z INFO Agent] ExecuteCommand
[2022-02-05 18:38:38Z INFO ConfigurationStore] currentAssemblyLocation: C:\azagent\A2\bin\Agent.Listener.dll
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO ConfigurationStore] binPath: C:\azagent\A2\bin
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO ConfigurationStore] RootFolder: C:\azagent\A2
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'Agent': 'C:\azagent\A2\.agent'
[2022-02-05 18:38:38Z INFO ConfigurationStore] ConfigFilePath: C:\azagent\A2\.agent
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'Credentials': 'C:\azagent\A2\.credentials'
[2022-02-05 18:38:38Z INFO ConfigurationStore] CredFilePath: C:\azagent\A2\.credentials
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'Service': 'C:\azagent\A2\.service'
[2022-02-05 18:38:38Z INFO ConfigurationStore] ServiceConfigFilePath: C:\azagent\A2\.service
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'Autologon': 'C:\azagent\A2\.autologon'
[2022-02-05 18:38:38Z INFO ConfigurationStore] AutoLogonSettingsFilePath: C:\azagent\A2\.autologon
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'Options': 'C:\azagent\A2\.options'
[2022-02-05 18:38:38Z INFO ConfigurationStore] RuntimeOptionsFilePath: C:\azagent\A2\.options
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO HostContext] Well known config file 'SetupInfo': 'C:\azagent\A2\.setup_info'
[2022-02-05 18:38:38Z INFO ConfigurationStore] SetupInfoFilePath: C:\azagent\A2\.setup_info
[2022-02-05 18:38:38Z INFO Terminal] WRITE LINE: 
  ___                      ______ _            _ _
 / _ \                     | ___ (_)          | (_)
/ /_\ \_____   _ _ __ ___  | |_/ /_ _ __   ___| |_ _ __   ___  ___
|  _  |_  / | | | '__/ _ \ |  __/| | '_ \ / _ \ | | '_ \ / _ \/ __|
| | | |/ /| |_| | | |  __/ | |   | | |_) |  __/ | | | | |  __/\__ \
\_| |_/___|\__,_|_|  \___| \_|   |_| .__/ \___|_|_|_| |_|\___||___/
                                   | |
        agent v2.198.2             |_|          (commit d1b8588)

[2022-02-05 18:38:38Z INFO ConfigurationManager] CheckAgentRootDirectorySecure
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Bin': 'C:\azagent\A2\bin'
[2022-02-05 18:38:38Z INFO HostContext] Well known directory 'Root': 'C:\azagent\A2'
[2022-02-05 18:38:38Z INFO ConfigurationManager] ConfigureAsync
[2022-02-05 18:38:38Z INFO ConfigurationStore] IsConfigured()
[2022-02-05 18:38:38Z INFO ConfigurationStore] IsConfigured: False
[2022-02-05 18:38:38Z INFO ConfigurationManager] Is configured: False
[2022-02-05 18:38:38Z INFO CommandSettings] Flag 'sslskipcertvalidation': 'False'
[2022-02-05 18:38:38Z INFO ConfigurationManager] Testing for min NET Framework version: '4.6'
[2022-02-05 18:38:38Z INFO CommandSettings] Flag 'deploymentgroup': 'False'
[2022-02-05 18:38:38Z INFO CommandSettings] Flag 'deploymentpool': 'False'
[2022-02-05 18:38:38Z INFO CommandSettings] Flag 'environment': 'True'
[2022-02-05 18:38:38Z INFO ExtensionManager] Getting extensions for interface: 'Microsoft.VisualStudio.Services.Agent.Listener.Configuration.IConfigurationProvider'
[2022-02-05 18:38:38Z INFO ExtensionManager] Creating instance: Microsoft.VisualStudio.Services.Agent.Listener.Configuration.BuildReleasesAgentConfigProvider, Agent.Listener
[2022-02-05 18:38:38Z INFO ExtensionManager] Creating instance: Microsoft.VisualStudio.Services.Agent.Listener.Configuration.DeploymentGroupAgentConfigProvider, Agent.Listener
[2022-02-05 18:38:38Z INFO ExtensionManager] Creating instance: Microsoft.VisualStudio.Services.Agent.Listener.Configuration.SharedDeploymentAgentConfigProvider, Agent.Listener
[2022-02-05 18:38:38Z INFO ExtensionManager] Creating instance: Microsoft.VisualStudio.Services.Agent.Listener.Configuration.EnvironmentVMResourceConfigProvider, Agent.Listener
[2022-02-05 18:38:38Z INFO Terminal] WRITE LINE: 
[2022-02-05 18:38:38Z INFO Terminal] WRITE LINE: >> Connect:
[2022-02-05 18:38:38Z INFO Terminal] WRITE LINE: 
[2022-02-05 18:38:38Z INFO CommandSettings] Arg 'url': 'https://dev.azure.com/organization/'
[2022-02-05 18:38:38Z INFO EnvironmentVMResourceConfigProvider] url - https://dev.azure.com/organization/
[2022-02-05 18:38:38Z INFO ConfigurationManager] GetCredentialProvider
[2022-02-05 18:38:38Z INFO CommandSettings] Arg 'auth': 'PAT'
[2022-02-05 18:38:38Z INFO ConfigurationManager] Creating credential for auth: PAT
[2022-02-05 18:38:38Z INFO CredentialManager] GetCredentialProvider
[2022-02-05 18:38:38Z INFO CredentialManager] Creating type PAT
[2022-02-05 18:38:38Z INFO CredentialManager] Creating credential type: PAT
[2022-02-05 18:38:38Z INFO PersonalAccessToken] EnsureCredential
[2022-02-05 18:38:38Z INFO CommandSettings] Arg 'token': '***'
[2022-02-05 18:38:38Z INFO PersonalAccessToken] GetVssCredentials
[2022-02-05 18:38:38Z INFO PersonalAccessToken] token retrieved: 52 chars
[2022-02-05 18:38:38Z INFO PersonalAccessToken] cred created
[2022-02-05 18:38:38Z INFO ConfigurationManager] cred retrieved
[2022-02-05 18:38:38Z INFO VisualStudioServices] Starting operation Location.GetConnectionData
[2022-02-05 18:38:38Z WARN VisualStudioServices] Attempt 1 of GET request to https://dev.azure.com/organization/_apis/connectionData?connectOptions=1&lastChangeId=320929845&lastChangeId64=320929845 failed (Socket Error: ConnectionReset). The operation will be retried in 10,8320613 seconds.
[2022-02-05 18:38:49Z WARN VisualStudioServices] Attempt 2 of GET request to https://dev.azure.com/organization/_apis/connectionData?connectOptions=1&lastChangeId=320929845&lastChangeId64=320929845 failed (Socket Error: ConnectionReset). The operation will be retried in 13,2434562 seconds.
[2022-02-05 18:39:03Z WARN VisualStudioServices] Attempt 3 of GET request to https://dev.azure.com/organization/_apis/connectionData?connectOptions=1&lastChangeId=320929845&lastChangeId64=320929845 failed (Socket Error: ConnectionReset). The operation will be retried in 15,8216932 seconds.
[2022-02-05 18:39:18Z ERR  VisualStudioServices] Attempt 4 of GET request to https://dev.azure.com/organization/_apis/connectionData?connectOptions=1&lastChangeId=320929845&lastChangeId64=320929845 failed (Socket Error: ConnectionReset). The maximum number of attempts has been reached.
[2022-02-05 18:39:18Z INFO VisualStudioServices] Finished operation Location.GetConnectionData
[2022-02-05 18:39:18Z INFO LocationServer] Unable to connect to https://dev.azure.com/organization/.
[2022-02-05 18:39:19Z ERR  LocationServer] System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
 ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
   at System.Net.FixedSizeReader.ReadPacketAsync(Stream transport, AsyncProtocolRequest request)
   at System.Net.Security.SslStream.ThrowIfExceptional()
   at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__65_1(IAsyncResult iar)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Services.Common.VssHttpRetryMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   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.Location.Client.LocationHttpClient.GetConnectionDataAsync(ConnectOptions connectOptions, Int64 lastChangeId, CancellationToken cancellationToken, Object userState)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.GetConnectionDataAsync(ConnectOptions connectOptions, Int32 lastChangeId, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.ConnectAsync(ConnectOptions connectOptions, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.LocationServer.ConnectAsync(VssConnection jobConnection)
[2022-02-05 18:39:19Z INFO CommandSettings] Flag 'unattended': 'False'
[2022-02-05 18:39:19Z ERR  Terminal] WRITE ERROR (exception):
[2022-02-05 18:39:19Z ERR  Terminal] System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
 ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
   at System.Net.FixedSizeReader.ReadPacketAsync(Stream transport, AsyncProtocolRequest request)
   at System.Net.Security.SslStream.ThrowIfExceptional()
   at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
   at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__65_1(IAsyncResult iar)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Services.Common.VssHttpRetryMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   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.Location.Client.LocationHttpClient.GetConnectionDataAsync(ConnectOptions connectOptions, Int64 lastChangeId, CancellationToken cancellationToken, Object userState)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.GetConnectionDataAsync(ConnectOptions connectOptions, Int32 lastChangeId, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.ConnectAsync(ConnectOptions connectOptions, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.LocationServer.ConnectAsync(VssConnection jobConnection)
   at Microsoft.VisualStudio.Services.Agent.Util.ServerUtil.GetConnectionData(String serverUrl, VssCredentials credentials, ILocationServer locationServer)
   at Microsoft.VisualStudio.Services.Agent.Util.ServerUtil.DetermineDeploymentType(String serverUrl, VssCredentials credentials, ILocationServer locationServer)
   at Microsoft.VisualStudio.Services.Agent.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command)
[2022-02-05 18:39:19Z ERR  Terminal] WRITE ERROR: Failed to connect.  Try again or ctrl-c to quit
[2022-02-05 18:39:59Z INFO CommandSettings] Arg 'url': 'https://dev.azure.com/organization/'
[2022-02-05 18:39:59Z INFO EnvironmentVMResourceConfigProvider] url - https://dev.azure.com/organization/
[2022-02-05 18:39:59Z INFO ConfigurationManager] GetCredentialProvider
[2022-02-05 18:39:59Z INFO CommandSettings] Arg 'auth': 'PAT'
[2022-02-05 18:39:59Z INFO ConfigurationManager] Creating credential for auth: PAT
[2022-02-05 18:39:59Z INFO CredentialManager] GetCredentialProvider
[2022-02-05 18:39:59Z INFO CredentialManager] Creating type PAT
[2022-02-05 18:39:59Z INFO CredentialManager] Creating credential type: PAT
[2022-02-05 18:39:59Z INFO PersonalAccessToken] EnsureCredential
[2022-02-05 18:39:59Z INFO CommandSettings] Arg 'token': '***'
[2022-02-05 18:39:59Z INFO PersonalAccessToken] GetVssCredentials
[2022-02-05 18:39:59Z INFO PersonalAccessToken] token retrieved: 52 chars
[2022-02-05 18:39:59Z INFO PersonalAccessToken] cred created
[2022-02-05 18:39:59Z INFO ConfigurationManager] cred retrieved
[2022-02-05 18:39:59Z INFO VisualStudioServices] Starting operation Location.GetConnectionData
[2022-02-05 18:39:59Z WARN VisualStudioServices] Attempt 1 of GET request to https://dev.azure.com/organization/_apis/connectionData?connectOptions=1&lastChangeId=320929845&lastChangeId64=320929845 failed (Socket Error: ConnectionReset). The operation will be retried in 10,8212117 seconds.
[2022-02-05 18:40:10Z WARN VisualStudioServices] Attempt 2 of GET request to https://dev.azure.com/organization/_apis/connectionData?connectOptions=1&lastChangeId=320929845&lastChangeId64=320929845 failed (Socket Error: ConnectionReset). The operation will be retried in 13,0277663 seconds.
[2022-02-05 18:40:11Z INFO Terminal] WRITE LINE: Exiting...

【问题讨论】:

标签: azure-devops azure-agent


【解决方案1】:

如果人们仍然遇到这种情况,我找到了一个脚本,可以检查所有问题并生成有效的解决方案 :-)

Azure DevOps TLS 1.2 转换就绪检查器

Azure DevOps 服务(与许多其他 Microsoft 服务一样)正在过渡到弃用传输协议 TLS 1.0、TLS 1.1 和一些被认为很弱的 TLS 1.2 密码套件。

在此处查看 Azure DevOps 团队的公告:https://devblogs.microsoft.com/devops/deprecating-weak-cryptographic-standards-tls-1-0-and-1-1-in-azure-devops-services/

该项目的目的是简化过渡准备工作。我们收集了客户报告的最常见的 TLS 兼容性问题,并制作了一个脚本来检测这些问题并将用户指向缓解措施。

运行脚本:

AzureDevOpsTls12Analysis.ps1

在 Powershell 版本 4 或更高版本中运行。仅限 Windows,该脚本已在 Windows Server 2012 R2 及更高版本上测试。

脚本的作用:

  • 通过打开与https://status.dev.azure.com 的测试安全连接来执行探测。在弃用 TLS 1.0 和 1.1 协议后,此站点需要 TLS 1.2 和强密码套件,所有 Azure DevOps 站点也需要。
    • 探测器会识别出问题是网络连接或 DNS 解析问题,还是由 TLS 不兼容引起的。
    • 成功的探测证明操作系统允许 TLS 1.2 并且至少有一个所需的密码套件可用。这并不能保证从这台计算机连接到 Azure DevOps 的所有其他软件都可以正常工作而不会出现 TLS 问题。
  • 通过查看启用/禁用 TLS 1.2 协议并影响可用密码套件集的选定 Windows 注册表项来执行操作系统级别问题的分析。操作系统级别的配置由所有使用操作系统提供的 HTTPS/TLS 堆栈的软件共享。
  • 执行 .NET Framework 分析:检查 Windows 注册表中安装和配置的 .NET Framework 版本。
    • 查找注册表更改的存在,这些更改使针对 4.7 之前的 .NET Framework 版本构建的 .NET 应用程序能够利用操作系统支持的 TLS 功能。如果没有这些更改,即使操作系统启用了 TLS 1.2,旧的 .NET 应用也会默认使用 TLS 1.0。
    • 如果您不打算在计算机上使用通过网络进行通信的旧 .NET 程序,则无需应用这些程序。

脚本没有:

  • 脚本本身不执行任何缓解措施。它只打印缓解建议,其中包括文档文章的 URL 和要执行的步骤(要调用的 cmdlet 或要进行的注册表更改)。
  • 脚本不需要提升权限即可运行。
  • 脚本无法说明特定应用程序是否会出现 TLS 问题。有些应用具有硬编码或配置选择的 TLS/SSL 版本。

源码和脚本:

https://github.com/microsoft/azure-devops-tls12

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-20
    • 2021-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-06
    • 1970-01-01
    • 2022-07-02
    相关资源
    最近更新 更多