关于现有Azure Service Fabric集群的WadCfg更新及ARM模板下载的疑问
Great questions! Let's break this down for you step by step:
1. Can I download the ARM template and template-params file for an existing Service Fabric cluster?
Absolutely! Azure provides built-in tools to export the full ARM template and corresponding parameter file for your existing cluster. Here's how:
- Via Azure Portal:
- Navigate to your Service Fabric cluster resource.
- In the left-hand menu, under Automation, select Export template.
- You'll see the complete ARM template and parameter file. Click Download to save both locally.
Note: Sensitive values like passwords will be masked with
******in the parameter file, so you'll need to manually update those if you plan to reuse the template for full deployments. For your use case (adding performance counters), this won't be a blocker since you're only modifying specific sections. - Via Azure CLI:
Run this command to export the template directly to your local machine:
You can extract the parameters from the exported template or use additional flags to generate a separate params file if needed.az resource export --resource-group <your-resource-group-name> --name <your-cluster-name> --resource-type Microsoft.ServiceFabric/clusters --output json > cluster-template.json
2. If I can't download them, can I only update the "WadCfg" section to add new performance counters?
Yes, you don't need to redeploy the entire cluster or build a full parameter file from scratch. You can perform an incremental ARM deployment that only modifies the WadCfg portion of your cluster's configuration. Here's how to do it:
Option 1: Update via Azure Portal
- Go to your Service Fabric cluster resource.
- Select Deploy a custom template under Automation.
- Choose Edit template, then locate the
WadCfgnode within thepropertiessection of the cluster resource. - Add your new performance counter configurations to the
DiagnosticMonitorConfiguration > PerformanceCountersarray. For example:"WadCfg": { "DiagnosticMonitorConfiguration": { "overallQuotaInMB": 5120, "PerformanceCounters": { "scheduledTransferPeriod": "PT1M", "PerformanceCounterConfiguration": [ // Existing counters here { "counterSpecifier": "\\Service Fabric Cluster(*)\\CPU Usage", "sampleRate": "PT15S", "unit": "Percent" }, { "counterSpecifier": "\\Service Fabric Cluster(*)\\Memory Usage", "sampleRate": "PT15S", "unit": "Bytes" } ] } } } - Save the template, then proceed to deployment. You only need to fill in the required parameters (like cluster name, resource group) – all other existing settings will be preserved.
Option 2: Update via Azure CLI
Create a minimal ARM template that only includes the WadCfg update (you can base this on a snippet from the official docs or your current cluster config). Then run:
az deployment group create --resource-group <your-resource-group-name> --template-file <updated-wadcfg-template.json> --parameters clusterName=<your-cluster-name>
This will apply only the changes to the WadCfg section without touching other cluster settings.
Important Tip: Before making changes, always back up your current
WadCfgconfiguration. This way you can roll back quickly if something goes wrong.
内容的提问来源于stack exchange,提问作者ashwini verma

