1

我目前正在尝试部署一个 Azure 负载均衡器实例,以提供对两个防火墙的负载均衡访问。这是为了提供伪 HA 配置。

但是,当我尝试使用 Jenkins 部署此模板时,它给了我以下无用的响应(即使使用 --debug 命令):

DEBUG: attempting to read file Test/deployment/azuredeploy.json as utf-8-sig
DEBUG: attempting to read file Test/parameters/deploymentParameters.json as utf-8-sig
DEBUG: No tty
available.
ERROR:

所以它说有一个错误,但不能告诉我错误是什么。

我有两个要求:

  1. 谁能告诉我如何找出导致此错误的原因?有什么我不知道的命令或工具吗?

  2. 如果有人精通 ARM 的 Azure 负载均衡器语法,那么您可以看看我的部署模板,如果它有任何直接的缺陷,请告诉我。代码如下。

代码:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "virtualNetworkName": {
            "type": "string",
            "metadata": {
                "description": "vnet name"
            }
        },
        "subnet1Name": {
            "type": "string",
            "metadata": {
                "description": "Subnet 1 name"
            }
        },
        "subnet2Name": {
            "type": "string",
            "metadata": {
                "description": "Subnet 2 name"
            }
        },
        "loadBalancerName": {
            "type": "string",
            "metadata": {
                "description": "name of the load balancer instance"
            }
        },
        "nicName1": {
            "type": "string",
            "metadata": {
                "description": "name of NIC 1"
            }
        },
        "nicName2": {
            "type": "string",
            "metadata": {
                "description": "name of NIC 2"
            }
        },
        "nicName3": {
            "type": "string",
            "metadata": {
                "description": "name of NIC 3"
            }
        },
        "nicName4": {
            "type": "string",
            "metadata": {
                "description": "name of NIC 4"
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Location for all resources."
            }
        }
    },
    "variables": {
        "virtualNetworkName": "[parameters('virtualNetworkName')]",
        "subnet1Name": "[parameters('subnet1Name')]",
        "subnet2Name": "[parameters('subnet2Name')]",
        "loadBalancerName": "[parameters('loadBalancerName')]",
        "nicName1": "[parameters('nicName1')]",
        "nicName2": "[parameters('nicName2')]",
        "nicName3": "[parameters('nicName3')]",
        "nicName4": "[parameters('nicName4')]",
        "subnetRef1": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnet1Name'))]",
        "subnetRef2": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnet2Name'))]"
    },
    "resources": [
        {
            "apiVersion": "2018-08-01",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[variables('nicName1')]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'))]"
            ],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig-firewallBE",
                        "properties": {
                            "subnet": {
                                "id": "[variables('subnetRef1')]"
                            },
                            "loadBalancerBackendAddressPools": [
                                {
                                    "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')),'/backendAddressPools/firewallBE-subnet-pool')]"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "apiVersion": "2018-08-01",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[variables('nicName2')]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'))]"
            ],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig-firewallBE",
                        "properties": {
                            "subnet": {
                                "id": "[variables('subnetRef1')]"
                            },
                            "loadBalancerBackendAddressPools": [
                                {
                                    "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')),'/backendAddressPools/firewallBE-subnet-pool')]"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "apiVersion": "2018-08-01",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[variables('nicName3')]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'))]"
            ],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig-firewallFE",
                        "properties": {
                            "subnet": {
                                "id": "[variables('subnetRef2')]"
                            },
                            "loadBalancerBackendAddressPools": [
                                {
                                    "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')),'/backendAddressPools/firewallFE-subnet-pool')]"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "apiVersion": "2018-08-01",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[variables('nicName4')]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'))]"
            ],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "ipconfig-firewallFE",
                        "properties": {
                            "subnet": {
                                "id": "[variables('subnetRef2')]"
                            },
                            "loadBalancerBackendAddressPools": [
                                {
                                    "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')),'/backendAddressPools/firewallFE-subnet-pool')]"
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "apiVersion": "2017-08-01",
            "name": "[variables('loadBalancerName')]",
            "type": "Microsoft.Network/loadBalancers",
            "location": "[parameters('location')]",
            "sku": {
                "name": "Standard"
            },
            "properties": {
                "frontendIPConfigurations": [
                    {
                        "name": "firewallBE-FrontEnd",
                        "properties": {
                            "subnet": {
                                "id": "[variables('subnetRef1')]"
                            }
                        }
                    },
                    {
                        "name": "firewallFE-FrontEnd",
                        "properties": {
                            "subnet": {
                                "id": "[variables('subnetRef2')]"
                            }
                        }
                    }
                ],
                "backendAddressPools": [
                    {
                        "name": "firewallBE-subnet-pool"
                    },
                    {
                        "name": "firewallFE-subnet-pool"
                    }
                ],
                "loadBalancingRules": [
                    {
                        "properties": {
                            "frontendIPConfiguration": {
                                "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIpConfigurations/firewallBE-FrontEnd')]"
                            },
                            "backendAddressPool": {
                                "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/backendAddressPools/firewallBE-subnet-pool')]"
                            },
                            "probe": {
                                "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/probes/firewall-lb-probe')]"
                            },
                            "protocol": "All",
                            "frontendPort": 0,
                            "backendPort": 0
                        },
                        "name": "firewallBE-subnet-rule"
                    },
                    {
                        "properties": {
                            "frontendIPConfiguration": {
                                "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIpConfigurations/firewallFE-FrontEnd')]"
                            },
                            "backendAddressPool": {
                                "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/backendAddressPools/firewallFE-subnet-pool')]"
                            },
                            "probe": {
                                "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/probes/firewall-lb-probe')]"
                            },
                            "protocol": "All",
                            "frontendPort": 0,
                            "backendPort": 0
                        },
                        "name": "firewallFE-subnet-rule"
                    }
                ],
                "probes": [
                    {
                        "properties": {
                            "protocol": "Tcp",
                            "port": 0,
                            "intervalInSeconds": 15,
                            "numberOfProbes": 2
                        },
                        "name": "firewall-lb-probe"
                    }
                ]
            }
        }
    ]
}          
4

1 回答 1

2

在这种情况下,错误是由于缺少需要传递给模板的参数

于 2019-01-10T17:45:52.353 回答