0

我想在 NSG 中使用单个 securityRule,而不是为每个目标端口使用单独的规则。

我在下面的模板中使用了带有多个端口的destinationPortRanges,而不是带有单个端口的destinationPortRange。

{
    "name": "test-nsg-005",
    "type": "Microsoft.Network/networkSecurityGroups",
    "apiVersion": "2018-06-01",
    "location": "[variables('location')]",
    "properties": {
        "securityRules": [                {
                "name": "Allow ports",
                "properties": {
                    "priority": 1000,
                    "sourceAddressPrefix": "*",
                    "protocol": "TCP",
                    "destinationPortRanges": [
                        "22",
                        "443"                            
                    ],
                    "access": "Allow",
                    "direction": "Inbound",
                    "sourcePortRange": "*",
                    "destinationAddressPrefix": "*"
                }
            }]
    }
}  

当我尝试使用 Azure CLI 运行上述模板时,由于以下错误,我无法继续

根据验证程序,模板部署“测试”无效。跟踪 ID 为“0ee64525-9d2b-49cb-bac7-24baa73ac1d7”。有关详细信息,请参阅内部错误。有关使用详情,请参阅https://aka.ms/arm-deploy

更新:-

{"error":{"code":"InvalidTemplateDeployment","message":"The template deployment \'test\' is not valid according to the validation procedure. The tracking id is \'1e7527bc-6c7f-4aa9-8ed6-235402a229b7\'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.","details":[{"code":"InvalidResourceName","message":"Resource name Allow ports is invalid. The name can be up to 80 characters long. It must begin with a word character, and it must end with a word character or with \'_\'. The name may contain word characters or \'.\', \'-\', \'_\'.","details":[]}]}}'
msrest.exceptions : The template deployment 'test' is not valid according to the validation procedure. The tracking id is '1e7527bc-6c7f-4aa9-8ed6-235402a229b7'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.

我收到上述错误,重命名安全规则名称后,问题得到解决。

4

1 回答 1

1

该错误是由于安全规则名称错误造成的。

于 2018-08-22T11:51:35.657 回答