0

I need to update the dns of my domain to the Azure Web App IP, however, upong testing it on the browser, this is the result:

screenshot 1

I googled around and found this:

First scenario

If you, as an app owner, are using a custom domain with an Azure Web App, then Azure needs to be configured for recognizing the custom domain name, so that it can route the request to the appropriate server in the region.

After registering the domain with a domain provider and configuring a DNS CNAME record to point to the app's Azurewebsites.net address (for example, wordpressbyayush.azurewebsites.net), the web app owner also needs to go to the Azure Portal and configure the app for the new domain.

Second scenario

The Web App is stored in a data center located in the region that the Web App owner has selected while creating the app. Azure's DNS server resolves the Web App address that was chosen for it to that data center.

DNS servers are in charge of resolving the name of the server that the user is trying to reach into an IP address, but clients cache this information in order to be able to load the page as fast as possible. If this app was deleted and re-created in another region, the new app will have a different IP address, but the client might still be caching the old IP address.

However, it's not clear enough. This is my custom domain screen:

screenshot 2

How do I add the custom domain name?!

And for the love of all that's holy, why can't I access the website through the IP address? If I set my domain A to that IP, will it work? I have my doubts now.

1

You would simply click the Add Hostname, and add www.whateverdomain.com in. At that point, Azure will try to verify the new hostname... So you will want to have the DNS already setup to point to your Azure IP for the web app. You could try it without DNS setup, it may have other options now (It seems like every time I login lately, that azure has new features/options). Worst case scenario you will need to remove the custom name and re-add it.

If you are just looking to test something on your webapp and do not own a custom domain or do not want to wait for DNS etc, you can modify your hosts file on your local workstation. Assuming a Windows OS, modify the file: c:\windows\system32\drivers\etc\hosts At the end of the file add a new line with your IP, space, your domain name. So:

1.2.3.4 www.whateverdomain.com

Then you will be able to browse to www.whateverdomain.com and it should work.

Azure I believe is looking for the host headers. With this hosts file trick, your machine will send the host header in the request that Azure is looking for.

0

Instructions were unclear.

Turns out that all you have to do is add a hostname and not a domain name.

It validates if the domain you're trying to use has the correct dns config (A to ip address and CNAME to web app address, ie. webapp.azurewebsites.net)

0

there are 2 steps to adding a custom domain to an azure webapp.

  1. you have to use a standard or Premium App service plan. ( you can check for this by going to the azure app -> overview -> App service plan / price tier.

  2. in your Appservice go to Settings -> Custom domain

In custom domain setting you will get an IP address for your service, which you can then configure your dns A record to point to. I personally strongly Recommend against this but rather use a cname record ( for this cause you will just need to use the *.azurewebsites name). If you are dealing with scaled websites sometimes the ip address could lead to unforeseen issues. a cname address handles this for you.

In both cases CNAME/A record you will still need to go back to the custom domain settings and Click add the hostname to the one you created at your dns. This will allow azure to validate that you do own the domain you are trying to use.

go here for more information https://docs.microsoft.com/en-us/azure/app-service-web/web-sites-custom-domain-name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.