Search code examples
powershellazureazure-deployment

A CNAME record pointing from mytmp.trafficmanager.net to mywebapp.azurewebsites.net was not found


I am trying to create all my azure resources from PowerShell script. All resources are getting, but it is also throwing this exception.

A CNAME record pointing from mytmp.trafficmanager.net to mywebapp.azurewebsites.net was not found

But I can see a traffic manager endpoint has been configured properly. What do I miss here, any idea?

PS Code:

{
  "comments": "Generalized from resource: '/subscriptions/<subid>/resourceGroups/<rgid>/providers/Microsoft.Web/sites/<web_app_name>/hostNameBindings/<traffic_manager_dns>'.",
  "type": "Microsoft.Web/sites/hostNameBindings",
  "name": "[concat(parameters('<web_app_name>'), '/', parameters('hostNameBindings_<traffic_manager_dns>_name'))]",
  "apiVersion": "2016-08-01",
  "location": "South Central US",
  "scale": null,
  "properties": {
    "siteName": "<web_app_name>",
    "domainId": null,
    "hostNameType": "Verified"
  },
  "dependsOn": [
    "[resourceId('Microsoft.Web/sites', parameters('sites_<web_app_name>_name'))]"
  ]
}

Above code throws that exception actually. When I commented this code block everything is fine. But I wanted to understand the reason for the error.


Solution

  • A CNAME record pointing from mytmp.trafficmanager.net to mywebapp.azurewebsites.net was not found

    It indicates the DNS record is not created when deploying the template. You need to prove that you are the owner of the hostname. You also could test it from the Azure portal manually.

    Before deploy the template you need to create an CNAME record with your DNS provider. For more information you could refer to Map a CNAME record.

    enter image description here