共用方式為

通过 Azure CLI 创建安全服务Fabric Linux 群集

此命令创建一个自签名证书,将其添加到密钥保管库并在本地下载该证书。 新证书用于在群集部署时保护群集。 也可以使用现有证书而不是创建一个新证书。 无论哪种方式,证书主体名称都必须与您用于访问Service Fabric群集的域名相匹配。 需要此匹配才能为群集的 HTTPS 管理终结点和 Service Fabric Explorer 提供 TLS。 无法为.chinacloudapp.cn域从 CA 获取 TLS/SSL 证书。 您需要为您的群集获取一个自定义域名。 从 CA 请求证书时,该证书的使用者名称必须与用于群集的自定义域名匹配。

如果需要,请安装 Azure CLI

示例脚本

#!/bin/bash

# Variables
ResourceGroupName="aztestclustergroup" 
ClusterName="aztestcluster" 
Location="chinaeast" 
Password="q6D7nN%6ck@6" 
Subject="aztestcluster.chinaeast.cloudapp.chinacloudapi.cn" 
VaultName="aztestkeyvault" 
VmPassword="Mypa$$word!321"
VmUserName="sfadminuser"

# Create resource group
az group create --name $ResourceGroupName --location $Location 

# Create secure five node Linux cluster. Creates a key vault in a resource group
# and creates a certficate in the key vault. The certificate's subject name must match 
# the domain that you use to access the Service Fabric cluster.  The certificate is downloaded locally.
az sf cluster create --resource-group $ResourceGroupName --location $Location \ 
  --certificate-output-folder . --certificate-password $Password --certificate-subject-name $Subject \
  --cluster-name $ClusterName --cluster-size 5 --os UbuntuServer1604 --vault-name $VaultName \ 
  --vault-resource-group $ResourceGroupName --vm-password $VmPassword --vm-user-name $VmUserName

整理部署

运行脚本示例后,可以使用以下命令删除资源组、群集和所有相关资源。

ResourceGroupName = "aztestclustergroup"
az group delete --name $ResourceGroupName

脚本说明

此脚本使用以下命令。 表中的每条命令均链接到特定于命令的文档。

命令 备注
az sf cluster create(创建 Service Fabric 群集) 创建新的Service Fabric群集。

后续步骤

可以在 Service Fabric CLI 示例中找到适用于Azure Service Fabric的其他服务Fabric CLI 示例。