0
votes

I am creating an Azure Web app with the name "CustomerX-app-001" the default custom domain that Azure creates after the creation of the Azure web app is : "Customerx-app-001.azurewebsites.net".

Inside my arm template I've tried to change this default hostname to "Customerx-app.azurewebsites.net" by doing these 2 solutions:

Adding the hostnamebinding resource inside the resource block of microsoft.web/sites

   "resources": [
                {
                    "type": "hostNameBindings",
                    "apiVersion": "2018-11-01",
                    "name": "[concat(parameters('CustomHostname'), '.azurewebsites.net')]",
                    "location": "[resourceGroup().location]",
                    "dependsOn": [
                        "[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
                    ],
                    "properties": {
                        "siteName": "[parameters('siteName')]"
                    }
                },

**Adding the hostnamebinding resource outside as a new resource block **

{
            "type": "Microsoft.Web/sites/hostNameBindings",
            "apiVersion": "2018-11-01",
            "name": "[concat(parameters('siteName'), '/', parameters('CustomHostname'), '.azurewebsites.net')]",
            "location": "[resourceGroup().location]",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
            ],
            "properties": {
                "siteName": "[parameters('siteName')]",
                "hostNameType": "Verified"
            }
        }

With CustomHostname being: "Customerx-app" and sitename being "Customerx-app-001"

Both solutions gave me the same error:

 "Code": "BadRequest",
  "Message": "Too many (2) hostnames in the default DNS zone. Limit is 1.",
  "Target": null,
  "Details": [
    {
      "Message": "Too many (2) hostnames in the default DNS zone. Limit is 1."
    },
    {
      "Code": "BadRequest"
    },
    {
      "ErrorEntity": {
        "ExtendedCode": "04017",
        "MessageTemplate": "Too many ({0}) hostnames in the default DNS zone. Limit is {1}.",
        "Parameters": [
          "2",
          "1"
        ],
        "Code": "BadRequest",
        "Message": "Too many (2) hostnames in the default DNS zone. Limit is 1."
      }
    }

I am stuck at this for a while and figuring out why the problem occurs. I think that the azure web app has 1 default DNS name that you can't change and that is always the name of the web app. If another DNS name needs to be added a new DNS record should be made and this record can be added to the web app. But solution 2 does exactly that with the only difference that the DNS name does not exist.

Is there anyone who can help me out here, or guide me in the right direction ?

1
The answer by 4c74356b41 below is correct. But you can accomplish the same thing by just provisioning a new Azure Web App with the name Customerx-app. This will give you the domain name you're looking for of Customerx-app.azurewebsites.net.Rob Reagan
well, assuming that App Service name is available @RobReagan :)4c74356b41

1 Answers

1
votes

You can only use a single *.azurewebsites.net dns name and it is being autogenerated. You can only add dns names on a domain you own (and you'd have to validate it first).