將應用程式憑證新增到 Service Fabric 叢集Add an application certificate to a Service Fabric cluster

此範例指令碼會上傳現有應用程式的新版本,然後以新版本來升級部署的應用程式。This sample script uploads a new version of an existing application, and then upgrades a deployed application with the new bits.

重要

有兩個 CLI 公用程式用來與 Service Fabric 互動。There are two CLI utilities used to interact with Service Fabric. Azure CLI 用來管理 Azure 資源,例如 Azure 託管的 Service Fabric 叢集。Azure CLI is used to manage Azure resources, such as an Azure-hosted Service Fabric cluster. Service Fabric CLI 用來直接連線到 Service Fabric 叢集 (不論裝載於何處) 及管理叢集、應用程式和服務。Service Fabric CLI is used to directly connect to the Service Fabric cluster (regardless of where it's hosted) and manage the cluster, applications, and services.

範例指令碼Sample script

#!/bin/bash

# Select cluster
sfctl cluster select \
    --endpoint http://svcfab1.westus2.cloudapp.azure.com:19080

# Upload the latest bits of an application
sfctl application upload --path ~/app_package_dir_2

# Provision the new application
sfctl application provision --application-type-build-path app_package_dir_2

# Upgrade an existing up with the new version
sfctl application upgrade --app-id TestApp --app-version 2.0.0 --parameters "{\"test\":\"value\"}" --mode Monitored

後續步驟Next steps

如需詳細資訊,請參閱 Service Fabric CLI 文件For more information, see the Service Fabric CLI documentation.

您可以在 Service Fabric CLI 範例中找到適用於 Azure Service Fabric 的其他 Service Fabric CLI 範例。Additional Service Fabric CLI samples for Azure Service Fabric can be found in the Service Fabric CLI samples.