1
votes

I am trying to deploy a multi-tenant application to azure using following standalone deployment strategy.

  1. Create a new database for each tenant in azure elastic pool.
  2. Create a new app service instance for each tenant.
  3. Map a custom domain name for the app service instance using a domain name which already has purchased from Azure (Ex: tenantname.mydomain.com)

I am trying to do this using following ARM template (To reduce the complexity I have mentioned only the related area of the template)

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
    "sites_finaptestwebsite_name": {
        "defaultValue": "finaptestwebsite",
        "type": "String"
    },   
    "hostNameBindings_mydomain.finapsl.com_name": {
        "defaultValue": "mydomain.finapsl.com",
        "type": "String"
    },
    "hostNameBindings_finaptestwebsite.azurewebsites.net_name": {
        "defaultValue": "finaptestwebsite.azurewebsites.net",
        "type": "String"
    },
    "sites_finaptestwebsite_serverFarmId": {
        "defaultValue": "appServicePlanName",
        "type": "String"
    }
},
"variables": {},
"resources": [
    {
        "type": "Microsoft.Web/sites",
        "kind": "app",
        "name": "[parameters('sites_finaptestwebsite_name')]",
        "apiVersion": "2016-08-01",
        "location": "Central US",
        "scale": null,
        "properties": {
            "enabled": true,
            "hostNameSslStates": [
                {
                    "name": "[concat(parameters('sites_finaptestwebsite_name'),'.azurewebsites.net')]",
                    "sslState": "Disabled",
                    "virtualIP": null,
                    "thumbprint": null,
                    "toUpdate": null,
                    "hostType": "Standard"
                },
                {
                    "name": "[concat(parameters('sites_finaptestwebsite_name'),'.scm.azurewebsites.net')]",
                    "sslState": "Disabled",
                    "virtualIP": null,
                    "thumbprint": null,
                    "toUpdate": null,
                    "hostType": "Repository"
                },
                {
                    "name": "mydomain.finapsl.com",
                    "sslState": "Disabled",
                    "virtualIP": null,
                    "thumbprint": null,
                    "toUpdate": null,
                    "hostType": "Standard"
                }
            ],
            "serverFarmId": "[parameters('sites_finaptestwebsite_serverFarmId')]",
            "reserved": false,
            "siteConfig": null,
            "scmSiteAlsoStopped": false,
            "hostingEnvironmentProfile": null,
            "clientAffinityEnabled": true,
            "clientCertEnabled": false,
            "hostNamesDisabled": false,
            "containerSize": 0,
            "dailyMemoryTimeQuota": 0,
            "cloningInfo": null
        },
        "dependsOn": []
    },
    {
        "type": "Microsoft.Web/sites/hostNameBindings",
        "name": "[concat(parameters('sites_finaptestwebsite_name'), '/', parameters('hostNameBindings_finaptestwebsite.azurewebsites.net_name'))]",
        "apiVersion": "2016-08-01",
        "location": "Central US",
        "scale": null,
        "properties": {
            "siteName": "finaptestwebsite",
            "domainId": null,
            "hostNameType": "Verified"
        },
        "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('sites_finaptestwebsite_name'))]"
        ]
    },
    {
        "type": "Microsoft.Web/sites/hostNameBindings",
        "name": "[concat(parameters('sites_finaptestwebsite_name'), '/', parameters('hostNameBindings_mydomain.finapsl.com_name'))]",
        "apiVersion": "2016-08-01",
        "location": "Central US",
        "scale": null,
        "properties": {
            "siteName": "finaptestwebsite",
            "domainId": null,
            "azureResourceName": "finaptestwebsite",
            "azureResourceType": "Website",
            "customHostNameDnsRecordType": "CName",
            "hostNameType": "Managed"
        },
        "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('sites_finaptestwebsite_name'))]"
        ]
    }
]

}

Deployment fails with the error "A CNAME record pointing from mydomain.finapsl.com to {1} was not found. Alternative record awverify.mydomain.finapsl.com to awverify.finaptestwebsite2.azurewebsites.net was not found either."

Is it not possible to bind a custom domain name to an azure app service in this way? Your help is highly appreciated to solve this issue. I have been trying this more than two days.

1

1 Answers

0
votes

Try this: https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-custom-domain

Also, verify your CNAME record (that error message is pretty specific) perhaps with a 3rd party tool like https://mxtoolbox.com/CNAMELookup.aspx