Toto
Toto

Reputation: 139

Azure ARM can't create hostingEnvironments : 'Location has an invalid value'

I'm not able to create a "HostingEnvironments" in a ARM template. I usually use

"location": "[resourceGroup().location]"

but it seems not working for a resource of type "HostingEnvironments"

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

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

If I insert cabled string "West Europe" the resource is created.

Upvotes: 4

Views: 4428

Answers (1)

Bruce Chen
Bruce Chen

Reputation: 18465

According to your description, I assumed that you are deploying your WebApp with App Service Environment via Azure ARM template. Based on your template, I have tested it on my side and I could reproduce this issue.

I found a issue about creating an App Service Environment, and as Stefan Schackow who is the Principal Program Manager Lead of Azure Web Sites commented as follows:

Just in case anyone runs into this - we uncovered a bug where the App Service management infrastructure isn't correctly handling the normalized location string returned from the resourceGroup.Location() call. For now, the workaround is as mentioned above - grab the March 21st version of the templates and explicitly provide a string for "location" in the azuredeploy.parameters.json file.

For now, the workaround is that you need to explicitly provide a string for "location" in the azuredeploy.parameters.json file. I would report this issue, also you could add your feedback here.

Upvotes: 4

Related Questions