0
votes

i'd create a WebApp in Azure using a ARM template. The template is composed by :

  • VirtualNetwork
  • Subnet
  • HostingEnvironment
  • ServerFarm
  • Site.

The creation of Microsoft.Network/virtualNetworks goes fine. The creation of Microsoft.Network/virtualNetworks/subnets goes fine.

During the creation of Microsoft.Web/hostingEnvironments I receive the error 'Cannot find VirtualNetwork with name XXXX'... but the VirtualNetwork is present.

Here the template https://github.com/toto-castaldi/azure-templates/blob/master/serviceApp/template.json

1
oh yeah, I've run into the same issue when trying your template, no ideas whatsoever, probably another bug, just like location4c74356b41
I've created that template beacuse I need to set the "VNET Integration" for a Site/AppService. I'm trying to do that defining before a HostingEnvironment that has "VNETName" property. There is another way to do that ?Toto

1 Answers

0
votes

If use the template that you mentioned, I also can repro the issue. If add the following code in the properties,it can create hostingEnvironment successfully. Please have a try with the following code

  "virtualNetwork": {
          "Id": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet').name)]",
          "Subnet": "[variables('vnet').subnet.name]"
        },

The following is the whole code of the HostingEnvironment

{
      "apiVersion": "2016-09-01",
      "name": "[variables('hostingEnvironment').name]",
      "type": "Microsoft.Web/hostingEnvironments",
      "location": "[variables('location')]",
      "dependsOn": [
      ],
      "properties": {
        "Name": "[variables('hostingEnvironment').name]",
        "ipSslAddressCount": "[variables('hostingEnvironment').ipSslAddressCount]",
        "workerPools": [
          {
            "workerSizeId": 0,
            "workerSize": "medium",
            "workerCount": 1
          }
        ],
        "virtualNetwork": {
          "Id": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnet').name)]",
          "Subnet": "[variables('vnet').subnet.name]"
        },
        "location": "[variables('location')]",
        "MultiSize": "medium",
        "MultiRoleCount": "1",
        "VNETName": "[variables('vnet').name]",
        "VNetResourceGroupName": "[resourceGroup().name]",
        "VNETSubnetName": "[variables('vnet').subnet.name]"
      }
    }

Check from the Azure portal.

enter image description here