Azure/azure-quickstart-templates

App Service Environment deployment fails with Bad Request - Location parameter invalid

Opened this issue ยท 20 comments

Deploy an App Service Environment with an AppService Plan and Logic App onto an existing Virtual Network

Issue Details

Fails to deploy after a few seconds with error "Bad Request".

Status message

{
"Code": "BadRequest",
"Message": "The parameter Location has an invalid value.",
"Target": null,
"Details": [
{
"Message": "The parameter Location has an invalid value."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"Code": "BadRequest",
"Message": "The parameter Location has an invalid value.",
"ExtendedCode": "51008",
"MessageTemplate": "The parameter {0} has an invalid value.",
"Parameters": [
"Location"
],
"InnerErrors": null
}
}
],
"Innererror": null
}

Repro steps (if necessary, delete otherwise)

  1. Create Classic VNET
  2. Deploy with no changes, except VNET

I've been trying to work around this, and have found that the issue is caused by the function
resourceGroup().location
This function returns an object where the default string is something like "westus", whereas apparently the App Service Environment expects a display name like "West US". If I create a variable with that string, it runs fine.

I believe you're right. This template has a locations array: https://github.com/Azure/azure-quickstart-templates/blob/052db5feeba11f85d57f170d8202123511f72044/201-web-app-ase-create/azuredeploy.json
The fix should be easy.
Could you submit a pull request or you want I do it?

I've tried fixing it, but keep getting the same error. Multiple items have the location parameter, and it seems these don't all behave the same. I've abandoned this example, so I will not be submitting a pull request.

Known issue. Should be fixed soon.

Any update on this issue?
Thanks

This issue is still relevant it seems.

Yes, this issue seems to persist. I ran across this today.

I just came across this issue. :(

Still around...

Can we get an update on this from MSFT maintainer?

It appears that this issue is related to using classic Azure resources, and not ARM.
Any new deployments of App Service Environments should be utilizing ASE v2 templates, doing so will allow you to take advantage of new features and support for App Service Environments.

https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-asev2-create

https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-asev2-ilb-create

@cocallaw If that is the case, then maybe this sample should be deleted.

@mioteg sorry for the confusion, meant that the original issue you reported was encountered using a classic network and not ARM. Looking at the dates in this thread, it appears people are still using the V1 ASE on ARM and are still having issues. Wanted to pint out that there is ASEv2 which is getting new features added. The docs arenโ€™t that clear and donโ€™t distinguish v1 and v2 and that v2 is out there.

I am running some tests to see if I can reproduce the issue and sort out whatever issue there is with location properties on the resources.

Iโ€™m using ARM templates for ASEv2 and still needed the location workaround in order to deploy.

I have the same issue as @ph0rman, in fact it's possible to reproduce the issue with templates from this very repo.

This one for instance - https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-winrm-windows

I was trying to deploy the my first app service plan on ASEv2. This was the problem which was happening in both Azure Powershell & ARM Template. I was getting the following while deploying using ARM Templates -

Start-XzAseWebAppDeployment : Exception Message: 16:02:15 - Resource Microsoft.Web/serverfarms 'tests00-00' failed 
with message '{
  "Code": "BadRequest",
  "Message": "The parameter GeoRegion has an invalid value.",
  "Target": null,
  "Details": [
    {
      "Message": "The parameter GeoRegion has an invalid value."
    },
    {
      "Code": "BadRequest"
    },
    {
      "ErrorEntity": {
        "ExtendedCode": "51008",
        "MessageTemplate": "The parameter {0} has an invalid value.",
        "Parameters": [
          "GeoRegion"
        ],
        "Code": "BadRequest",
        "Message": "The parameter GeoRegion has an invalid value."
      }
    }
  ],
  "Innererror": null
}

I fixed the first deployment by setting Region as East US instead of eastus.

But, once the first App Service plan was deployed, I didn't have any issues using eastus as well. This seems to be happening only for first deployment.

This is still an issue with ASEv2.

UK South works
uksouth does not

@MCKLMT this is still an issue...any updates on a fix ETA? This is a blocker for us rolling out ASEs to production

One possible workaround until this issue is fixed is to create a variable which is essentially a lookup table mapping short Azure Region names to full Azure Region names and then to do a lookup of the short name provided by resourceGroup().Location and to put that back in a location variable to use in the remainder of the template:

"variables" : {
    "regions" : { "australiaeast" : "Australia East", 
                  "westus": "West US",
                  "eastus": "East US", 
                   ... 
                 },
    "location": "[variables('regions')[resourceGroup().location]]",
azsec commented

Changing API version to the newest API version 2019-08-01 should fix the issue.