Azure ARM模板"找不到具有名称的hostingEnvironment

时间:2017-07-31 09:15:15

标签: azure templates arm-template azure-resource-manager

我尝试部署App服务环境v2的ARM模板,我从官方Azure GitHub存储库https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-asp-app-on-asev2-create获取它。

当我启动它失败时,"找不到名为"的主机环境。

2 个答案:

答案 0 :(得分:1)

定价层标记为字符串,但分配的默认值为int,因此部署时为ARM模板barfs。

答案 1 :(得分:1)

您共享的模板不会为您创建ASE。通过单击编辑模板链接,我发现它只创建了2个Azure资源。一个是Azure Web App Plan,另一个是Azure Web App。

enter image description here

要获取创建ASE v2的ARM模板,您可以在Azure门户上执行创建操作。输入必填字段后,单击“自动化选项”以生成ARM模板。

enter image description here

以下是我身边生成的示例ARM模板。

{
    "parameters": {
        "vnetName": {
            "type": "string"
        },
        "vnetId": {
            "type": "string"
        },
        "location": {
            "type": "string"
        },
        "locationId": {
            "type": "string"
        },
        "subnetName": {
            "type": "string"
        },
        "VNetResourceGroupName": {
            "type": "string"
        },
        "subnetAddress": {
            "type": "string"
        },
        "vnetAddress": {
            "type": "string"
        },
        "subnetRouteTableName": {
            "type": "string"
        },
        "subnetNSGName": {
            "type": "string"
        },
        "name": {
            "type": "string"
        },
        "kind": {
            "type": "string"
        },
        "subscriptionId": {
            "type": "string"
        }
    },
    "resources": [
        {
            "name": "[parameters('name')]",
            "type": "Microsoft.Web/hostingEnvironments",
            "properties": {
                "name": "[parameters('name')]",
                "location": "[parameters('location')]",
                "VirtualNetwork": {
                    "Id": "[parameters('vnetId')]",
                    "type": "Microsoft.Network/virtualNetworks",
                    "Subnet": "[parameters('subnetName')]"
                }
            },
            "location": "[parameters('location')]",
            "dependsOn": [
                "[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]"
            ],
            "apiVersion": "2015-02-01",
            "kind": "[parameters('kind')]"
        },
        {
            "apiVersion": "2015-06-15",
            "type": "Microsoft.Network/routeTables",
            "name": "[parameters('subnetRouteTableName')]",
            "location": "[parameters('location')]",
            "tags": {
                "displayName": "UDR - Subnet"
            },
            "properties": {
                "routes": [
                    {
                        "name": "myase-route",
                        "properties": {
                            "addressPrefix": "0.0.0.0/0",
                            "nextHopType": "Internet"
                        }
                    }
                ]
            }
        },
        {
            "apiVersion": "2015-06-15",
            "type": "Microsoft.Network/networkSecurityGroups",
            "name": "[parameters('subnetNSGName')]",
            "location": "[parameters('location')]",
            "tags": {
                "displayName": "NSG - Subnet"
            },
            "properties": {
                "securityRules": [
                    {
                        "name": "Inbound-management",
                        "properties": {
                            "description": "Used to manage ASE from public VIP",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "454-455",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 100,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "ASE-internal-inbound",
                        "properties": {
                            "description": "ASE-internal-inbound",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "*",
                            "sourceAddressPrefix": "192.168.250.0/24",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 110,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "Inbound-HTTP",
                        "properties": {
                            "description": "Allow HTTP",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "80",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 120,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "Inbount-HTTPS",
                        "properties": {
                            "description": "Allow HTTPS",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "443",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 130,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "Inbound-FTP",
                        "properties": {
                            "description": "Allow FTP over port 21",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "21",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 140,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "Inbound-FTPS",
                        "properties": {
                            "description": "Allow FTPS",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "990",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 150,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "Inbound-FTP-Data",
                        "properties": {
                            "description": "RDP",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "10001-10020",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 160,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "Inbound-Remote-Debugging",
                        "properties": {
                            "description": "Visual Studio remote debugging",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "4016-4022",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 170,
                            "direction": "Inbound"
                        }
                    },
                    {
                        "name": "Outbound-443",
                        "properties": {
                            "description": "Azure Storage blob",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "443",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 100,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "Outbound-SMB",
                        "properties": {
                            "description": "Azure Storage queue",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "445",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 110,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "Outbound-DB",
                        "properties": {
                            "description": "Database",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "1433",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 120,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "Outbound-DB2",
                        "properties": {
                            "description": "Database 2",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "11000-11999",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 130,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "Outbound-DB3",
                        "properties": {
                            "description": "Database 3",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "14000-14999",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 140,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "Outbound-DNS",
                        "properties": {
                            "description": "DNS",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "53",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 150,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "ASE-internal-outbound",
                        "properties": {
                            "description": "Azure Storage queue",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "*",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "192.168.250.0/24",
                            "access": "Allow",
                            "priority": 160,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "Outbound-80",
                        "properties": {
                            "description": "Outbound 80",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "80",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "*",
                            "access": "Allow",
                            "priority": 170,
                            "direction": "Outbound"
                        }
                    },
                    {
                        "name": "ASE-to-VNET",
                        "properties": {
                            "description": "ASE to VNET",
                            "protocol": "*",
                            "sourcePortRange": "*",
                            "destinationPortRange": "*",
                            "sourceAddressPrefix": "*",
                            "destinationAddressPrefix": "192.168.250.0/23",
                            "access": "Allow",
                            "priority": 180,
                            "direction": "Outbound"
                        }
                    }
                ]
            }
        },
        {
            "apiVersion": "2016-06-01",
            "type": "Microsoft.Network/virtualNetworks",
            "name": "[parameters('vnetName')]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[concat('Microsoft.Network/networkSecurityGroups/', parameters('subnetNSGName'))]",
                "[concat('Microsoft.Network/routeTables/', parameters('subnetRouteTableName'))]"
            ],
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        "[parameters('vnetAddress')]"
                    ]
                },
                "subnets": [
                    {
                        "name": "[parameters('subnetName')]",
                        "properties": {
                            "addressPrefix": "[parameters('subnetAddress')]",
                            "networkSecurityGroup": {
                                "id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('subnetNSGName'))]"
                            },
                            "routeTable": {
                                "id": "[resourceId('Microsoft.Network/routeTables', parameters('subnetRouteTableName'))]"
                            }
                        }
                    }
                ]
            }
        }
    ],
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0"
}