如何在 ARM 模板中的单个 NSG SecurityRule 中使用多个目标端口
How to use multiple destination port in single NSG SecurityRule in ARM template
我想在 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 运行 上述模板时,由于以下错误我无法继续
The template deployment 'test' is not valid according to the
validation procedure. The tracking id is
'0ee64525-9d2b-49cb-bac7-24baa73ac1d7'. See inner errors for details.
Please see https://aka.ms/arm-deploy for usage details.
更新:-
{"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.
我收到上述错误,重命名安全规则名称后,问题已解决。
错误是由于错误的安全规则名称造成的。
我想在 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 运行 上述模板时,由于以下错误我无法继续
The template deployment 'test' is not valid according to the validation procedure. The tracking id is '0ee64525-9d2b-49cb-bac7-24baa73ac1d7'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.
更新:-
{"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.
我收到上述错误,重命名安全规则名称后,问题已解决。
错误是由于错误的安全规则名称造成的。