在现有模板中部署零安全规则

时间:2018-06-27 06:47:01

标签: json azure powershell-v3.0 azure-powershell arm-template

我有没有安全规则的部署模板,即安全规则的编号为0,但出现错误。我的模板在这里,我也附上了错误。

"resources": [

{
        "condition": "[equals(parameters('newOrExisting'),'new')]",
        "apiVersion": "2015-06-15",
        "type": "Microsoft.Network/networkSecurityGroups",
        "name": "[parameters('networkSecurityGroupSettings').name]",
        "location": "[resourceGroup().location]",
        "properties": {
            "mode": "Incremental",
            "copy": [{
                "name": "securityRules",
                "count": "[if(equals(parameters('noofsecurityrules'),0),1,parameters('noofsecurityrules'))]",
                "input": {
                    "name": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].name]",
                    "properties": {
                        "description": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].description]",
                        "priority": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].priority]",
                        "protocol": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].protocol]",
                        "sourcePortRange": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].sourcePortRange]",
                        "destinationPortRange": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].destinationPortRange]",
                        "sourceAddressPrefix": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].sourceAddressPrefix]",
                        "destinationAddressPrefix": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].destinationAddressPrefix]",
                        "access": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].access]",
                        "direction": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex('securityRules')].direction]"

                    }
                }
            }]
        }
    },
    {
        "condition": "[equals(parameters('newOrExisting'),'existing')]",
        "type": "Microsoft.Network/networkSecurityGroups/securityRules",
        "name": "[concat(variables('NSGname'), '/',parameters('networkSecurityGroupSettings').securityRules[copyIndex()].name)]",
        "apiVersion": "2015-06-15",
        "location": "[resourceGroup().location]",
        "properties": {
            "description": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].description]",
            "priority": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].priority]",
            "protocol": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].protocol]",
            "sourcePortRange": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].sourcePortRange]",
            "destinationPortRange": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].destinationPortRange]",
            "sourceAddressPrefix": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].sourceAddressPrefix]",
            "destinationAddressPrefix": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].destinationAddressPrefix]",
            "access": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].access]",
            "direction": "[parameters('networkSecurityGroupSettings').securityRules[copyIndex()].direction]"

        },
        "copy": {
            "name": "securityRulesCopy",
            "count": "[if(equals(parameters('noofsecurityrules'),0),1,parameters('noofsecurityrules'))]"
        }
    }

]

错误:

Code=InvalidTemplate; 
Message=Deployment template language expression evaluation failed: 'The language 
expression property '0' can't be evaluated.'.

0 个答案:

没有答案