我还没有对此进行测试,但似乎 copy/copyIndex 现在应该是流量管理器端点支持的场景:
https://feedback.azure.com/forums/217313-networking/suggestions/12907815-support-copy-copyindex-in-traffic-manager-depend
这是我不久前实施的一个示例:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"solution-abbreviation": {
"type": "string",
"minLength": 1
},
"environment-abbreviation": {
"type": "string",
"allowedValues": [
"dev",
"test",
"prod"
]
},
"userinterface-abbreviation": {
"type": "string",
"minLength": 1
},
"userinterface-locations": {
"type": "array",
"minLength": 1
},
"userinterface-appserviceplan-sku": {
"type": "string",
"allowedValues": [
"Free",
"Shared",
"Basic",
"Standard"
]
},
"userinterface-appserviceplan-workersize": {
"type": "string",
"allowedValues": [
"0",
"1",
"2"
]
},
"userinterface-appserviceplan-numberofworkers": {
"type": "int"
}
},
"variables": {
"userinterface-trafficmanager-name": "[concat(parameters('solution-abbreviation'), '-', parameters('environment-abbreviation'), '-', parameters('userinterface-abbreviation'))]"
},
"resources": [
{
"name": "[concat(variables('userinterface-trafficmanager-name'), '-', parameters('userinterface-locations')[copyIndex()])]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('userinterface-locations')[copyIndex()]]",
"apiVersion": "2014-06-01",
"dependsOn": [ ],
"tags": {
"displayName": "[concat(variables('userinterface-trafficmanager-name'), '-', parameters('userinterface-locations')[copyIndex()])]"
},
"copy": {
"name": "[concat('serverfarms', '-copy')]",
"count": "[length(parameters('userinterface-locations'))]"
},
"properties": {
"name": "[concat(variables('userinterface-trafficmanager-name'), '-', parameters('userinterface-locations')[copyIndex()])]",
"sku": "[parameters('userinterface-appserviceplan-sku')]",
"workerSize": "[parameters('userinterface-appserviceplan-workersize')]",
"numberOfWorkers": "[parameters('userinterface-appserviceplan-numberofworkers')]"
}
}
],
"outputs": {
}
}