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 ?