【Azure Fabric Service】Service Fabric 托管群集通过 Connect-ServiceFabricCluster 连接时候报错 CertificatedNotMatched

简介: 【Azure Fabric Service】Service Fabric 托管群集通过 Connect-ServiceFabricCluster 连接时候报错 CertificatedNotMatched

问题描述

Service Fabric 托管群集, 使用Key Vault中证书,把证书导入到本地安装后,使用该证书的 Thumbprint 作为指令 Connect-ServiceFabricCluster  的 ServerCertThumbprint 和FindValue 的值。结果连接失败,错误消息为:

Connect-ServiceFabricCluster FABRIC_E_SERVER_AUTHENTICATION_FAILED: CertificateNotMatched

 

 

问题解答

根据错误消息来看,就是使用的证书不对导致的。 而根据错误提示 FABRIC_E_SERVER_AUTHENTICATION_FAILED,  判断是 Connect-ServiceFabricCluster  中 ServerCertThumbprint 值错误。因为在自建的Service Fabric集群环境中, ServerCertThumbprint 和 FindValue (ClientCertThumbprint) 使用的同样的证书,所以他们值一样。

而Service Fabric 托管群集则不一样,Server Cert Thumbprint 需要通过 Get-AzResource 在集群的资源属性中获取。 托管集群将自动管理证书,并且在证书过期前的90天内自动更新。

 

1) 使用以下命令来查询群集资源,以获取群集证书指纹 ServerCertThumbprint  

$serverThumbprint = (Get-AzResource -ResourceId /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/managedclusters/mysfcluster)

.Properties.clusterCertificateThumbprints

2) 获取到 serverThumbprint后,使用下面的命令就可以连接到Service Fabric托管集群

##服务端证书指纹
$serverThumbprint = (Get-AzResource -ResourceId 'SF Resource ID' ).Properties.clusterCertificateThumbprints 
##客户端证书指纹
$clientThumbprint= "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
$connectionEndpoint = "<your sf name>.chinaeast2.cloudapp.chinacloudapi.cn:19000"
##连接到SF托管集群
Connect-ServiceFabricCluster -ConnectionEndpoint $connectionEndpoint -KeepAliveIntervalInSec 10 `
      -X509Credential `
      -ServerCertThumbprint $serverThumbprint  `
      -FindType FindByThumbprint `
      -FindValue $clientThumbprint `
      -StoreLocation CurrentUser `
      -StoreName My

引用文档: https://learn.microsoft.com/zh-cn/azure/service-fabric/how-to-managed-cluster-connect#using-the-service-fabric-powershell-module

3) 连接成功!

 

 

 

参考资料

连接到 Service Fabric 托管群集 : https://learn.microsoft.com/zh-cn/azure/service-fabric/how-to-managed-cluster-connect#using-the-service-fabric-powershell-module

Cluster certificate management and 90 day autorotation : https://learn.microsoft.com/en-us/azure/service-fabric/overview-managed-cluster#service-fabric-managed-cluster-advantages

 

目录
打赏
0
0
0
0
203
分享
相关文章
【Azure Service Fabric】关于Service Fabric的相关问题
【Azure Service Fabric】关于Service Fabric的相关问题
【Azure Fabric Service】演示使用PowerShell命令部署SF应用程序(.NET)
本文详细介绍了在中国区微软云Azure上使用Service Fabrics服务时,通过PowerShell命令发布.NET应用的全过程。由于Visual Studio 2022无法直接发布应用,需借助PowerShell脚本完成部署。文章分三步讲解:首先在Visual Studio 2022中打包应用部署包,其次连接SF集群并上传部署包,最后注册应用类型、创建实例并启动服务。过程中涉及关键参数如服务器证书指纹和服务端证书指纹的获取,并附带图文说明,便于操作。参考官方文档,帮助用户成功部署并运行服务。
99 72
【Azure Fabric Service】分享使用Visual Studio 2022发布中国区Service Fabric服务应用的办法
本文介绍了在Visual Studio 2022中无法直接创建Service Fabric Cluster服务时的替代方案。通过使用PowerShell命令或修改Cloud.xml文件,可将应用部署到已创建的SF Cluster。具体步骤包括:1) 在Azure门户创建Service Fabric服务并安装客户端证书;2) 获取服务端和客户端证书指纹;3) 修改Cloud.xml中的ClusterConnectionParameters后发布应用。最后附有参考资料以供进一步学习。
【Azure 微服务】新创建的Service Fabric集群,如何从本地机器上连接到Service Fabric Explorer(Service Fabric状态/错误查看工具)呢?
【Azure 微服务】新创建的Service Fabric集群,如何从本地机器上连接到Service Fabric Explorer(Service Fabric状态/错误查看工具)呢?
【Azure 微服务】新创建的Service Fabric集群,如何从本地机器上连接到Service Fabric Explorer(Service Fabric状态/错误查看工具)呢?
|
7月前
【Azure Fabric Service】Service Fabric部署失败问题 Provisioning of VM extension ConfigureVM has timed out.
【Azure Fabric Service】Service Fabric部署失败问题 Provisioning of VM extension ConfigureVM has timed out.
【Service Fabric】Service Fabric删不掉的问题
【Service Fabric】Service Fabric删不掉的问题
Hyperledger fabric 测试环境部署
Hyperledger fabric 测试环境部署及相关问题解答
366 3
Hyperledger fabric 测试环境部署
Hyperledger fabric智能合约编写(一)
本篇文章主要对链码编写的主要思路和部分API进行梳理。
264 1

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等