visual-studio - 如何让 Visual Studio 将应用程序发布到由证书公用名而不是指纹保护的 Service Fabric 群集?
问题描述
我按照此处记录的步骤将现有的 ARM 模板转换为使用公用名设置而不是指纹。部署成功,在典型的证书选择弹出窗口后,我能够使用浏览器连接到 Service Fabric Explorer。接下来,我尝试像以前一样将应用程序部署到集群中。即使我可以在 VS 公共服务结构应用程序对话框中看到集群连接端点 URI,VS 也无法连接到集群。之前,我会得到一个提示,允许 VS 访问本地证书。有谁知道如何让 VS 使用证书公用名将应用程序部署到服务结构集群设置?
从上面的 MS 链接中提取:
"virtualMachineProfile": {
"extensionProfile": {
"extensions": [`enter code here`
{
"name": "[concat('ServiceFabricNodeVmExt','_vmNodeType0Name')]",
"properties": {
"type": "ServiceFabricNode",
"autoUpgradeMinorVersion": true,
"protectedSettings": {
"StorageAccountKey1": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('supportLogStorageAccountName')),'2015-05-01-preview').key1]",
"StorageAccountKey2": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('supportLogStorageAccountName')),'2015-05-01-preview').key2]"
},
"publisher": "Microsoft.Azure.ServiceFabric",
"settings": {
"clusterEndpoint": "[reference(parameters('clusterName')).clusterEndpoint]",
"nodeTypeRef": "[variables('vmNodeType0Name')]",
"dataPath": "D:\\SvcFab",
"durabilityLevel": "Bronze",
"enableParallelJobs": true,
"nicPrefixOverride": "[variables('subnet0Prefix')]",
"certificate": {
"commonNames": [
"[parameters('certificateCommonName')]"
],
"x509StoreName": "[parameters('certificateStoreValue')]"
}
},
"typeHandlerVersion": "1.0"
}
},
和
{
"apiVersion": "2018-02-01",
"type": "Microsoft.ServiceFabric/clusters",
"name": "[parameters('clusterName')]",
"location": "[parameters('clusterLocation')]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('supportLogStorageAccountName'))]"
],
"properties": {
"addonFeatures": [
"DnsService",
"RepairManager"
],
"certificateCommonNames": {
"commonNames": [
{
"certificateCommonName": "[parameters('certificateCommonName')]",
"certificateIssuerThumbprint": ""
}
],
"x509StoreName": "[parameters('certificateStoreValue')]"
},
...
解决方案
我找到了 Visual Studio 的解决方案。我需要添加/更新PublishProfiles/Cloud.xml
文件。我替换ServerCertThumbprint
为ServerCommonName
,然后将证书 CN 用于新属性和现有FindValue
属性。此外,我将属性更改为FindType
to FindBySubjectName
。我现在能够成功连接并将我的应用程序发布到集群。
<ClusterConnectionParameters
ConnectionEndpoint="sf-commonnametest-scus.southcentralus.cloudapp.azure.com:19000"
X509Credential="true"
ServerCommonName="sfrpe2eetest.southcentralus.cloudapp.azure.com"
FindType="FindBySubjectName"
FindValue="sfrpe2eetest.southcentralus.cloudapp.azure.com"
StoreLocation="CurrentUser"
StoreName="My" />
推荐阅读
- lua - Lua:如何通过将字符串列入黑名单来阻止 io 库?和沙盒困境
- matlab - Matlab欧拉法
- maven - docker multistage spring boot build pom + 内部依赖
- javascript - 有什么方法可以告诉 Flow getElementById() 返回的 HTMLElement 不能为空?
- c++ - 多次打印出整个数组
- javascript - 使用 Grid fs 在 mongo 数据库中存储数千个图像文件,这是个好主意吗?
- python - 计算字符串中的子字符串,不包括一个字符串
- apache - 如何在 apache 上模拟 500 http 错误
- python - 不知道为什么我没有收到通知
- sql - Oracle SQL比较列值并选择最大值在第1列中的行