列出在 Service Fabric 群集中运行的应用程序List applications running in a Service Fabric cluster

此脚本示例将连接到 Service Fabric 群集并列出所有预配的应用程序。This sample script connects to a Service Fabric cluster and then lists all of the provisioned applications.

重要

可以使用两个 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.chinanorth2.cloudapp.chinacloudapi.cn:19080

# Retrieve all applications from the cluster
sfctl application list

后续步骤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.