我有一个利用服务结构的.net core 项目。我设置了一个构建管道来部署到 Azure 中的 Service Fabric 托管集群。在设置服务连接类型步骤时,我使用了与集群关联的证书。这是 keyvault 中的自签名证书。在部署过程中我不断收到以下错误
FABRIC_E_SERVER_AUTHENTICATION_FAILED: CertificateNotMatched
堆栈跟踪如下
2022-01-26T21:41:13.0165883Z ##[debug]Processed: ##vso[task.logissue type=warning]Failed to contact Failover Manager Service, Attempting to contact FMM...
2022-01-26T21:41:13.0587416Z ##[debug]System.Fabric.FabricServerAuthenticationFailedException: FABRIC_E_SERVER_AUTHENTICATION_FAILED: CertificateNotMatched ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071C44
2022-01-26T21:41:13.0600016Z ##[debug] at System.Fabric.Interop.NativeClient.IFabricQueryClient12.EndGetPartitionList2(IFabricAsyncOperationContext context)
2022-01-26T21:41:13.0611858Z ##[debug] at System.Fabric.FabricClient.QueryClient.GetPartitionListAsyncEndWrapper(IFabricAsyncOperationContext context)
2022-01-26T21:41:13.0623788Z ##[debug] at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously)
2022-01-26T21:41:13.0635475Z ##[debug] --- End of inner exception stack trace ---
2022-01-26T21:41:13.0854075Z ##[debug]System.Management.Automation.PipelineStoppedException: The pipeline has been stopped.
2022-01-26T21:41:13.0865504Z ##[debug] at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
2022-01-26T21:41:13.0876005Z ##[debug] at System.Management.Automation.Cmdlet.ThrowTerminatingError(ErrorRecord errorRecord)
2022-01-26T21:41:13.0886710Z ##[debug] at Microsoft.ServiceFabric.Powershell.CommonCmdletBase.TestClusterConnection(IClusterConnection clusterConnection, Boolean testNetwork)
2022-01-26T21:41:13.0897006Z ##[debug] at Microsoft.ServiceFabric.Powershell.ConnectCluster.ProcessRecord()
2022-01-26T21:41:13.0913858Z ##[debug]System.Management.Automation.PipelineStoppedException: The pipeline has been stopped.
2022-01-26T21:41:13.0924251Z ##[debug] at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
2022-01-26T21:41:13.0934735Z ##[debug] at System.Management.Automation.Cmdlet.ThrowTerminatingError(ErrorRecord errorRecord)
2022-01-26T21:41:13.0944961Z ##[debug] at Microsoft.ServiceFabric.Powershell.ConnectCluster.ProcessRecord()
2022-01-26T21:41:13.1818805Z ##[debug]Leaving Connect-ServiceFabricClusterFromServiceEndpoint.
我不知道从哪里开始才能找到它在这里寻找的东西。
当 Service Fabric 到 Service Fabric 连接中的一方提供的证书未满足收件人验证要求时,就会出现“证书不匹配”问题,这是连接尝试终止的可能原因之一。
根据此 MSFT documentation,要解决错误
'FABRIC E SERVER AUTHENTICATION FAILED,'
确定尝试连接的每个节点上显示的证书;研究证书并尝试复制验证规则(检查指纹或通用名称相等性)
我也有类似的问题并尝试使用多个证书。使用的每个证书都已部署到节点。唯一匹配成功的是
Primary
证书。
有两种确认主证书的方法。
Security
菜单下的 Settings
。 Cluster Certificate
部分具有主证书指纹。使用主证书的详细信息更新 Azure Devops(ADO) 中的集群服务连接并再次触发部署。
tcp://SF_NODE_IP:19000
(检查 Azure 门户中的负载均衡器资源以确认生成的 IP 地址)[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("REPLACE_PATH_TO_DOWNLOADED_CERT.pfx"))
通过导航到 Service Fabric 集群资源管理器 URL 修复您的服务连接
https://mysfurl.westeurope.cloudapp.azure.com:19080/Explorer/index.html
然后查看证书信息并将证书指纹复制到指纹中或将“颁发给”复制到服务连接的公用名称中。
部署将会成功