Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 29128

Windows Azure Web Sites: How to configure a custom domain

$
0
0

By default when users create a website on WAWS they hostname would be SITENAME.azurewebsites.net. So when I create a website called Kaushalz then the hostname would be Kaushalz.azurewebsites.net.

Windows Azure Web Sites allows user to configure custom domains as well. But this option is available when the website is scaled to either SHARED or STANDARD (Previously called RESERVED) mode.

There is already documentation on how to configure custom domain. Here is the link: http://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns-web-site/

However, I have still seen few customers running into issues in spite of this. I will be discussing in as much detail as possible.

So as we know there are 2 ways to configure domain names:

  1. Add an A record.
  2. Or you can add a CNAME record.

To explain this scenario I purchased a domain called www.kaushalz.org from GoDaddy.

Now I will show step by step how to configure this.


Create a website and scale it to SHARED/STANDARD

Logon to the Azure portal and create a website. If this is the first site being created in a specific data center then it would be scaled to FREE mode by default. You will have to scale it to either SHARED or STANDARD.

Refer this URL on how to do so: http://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns-web-site/#bkmk_configsharedmode

Once the website has been scaled to either SHARED or STANDARD, we can proceed further.


Configuration on the DNS Service Provider/DNS Server

As I stated earlier, I purchased a domain www.kaushalz.org form GoDaddy. So I will have to configure the routings on GoDaddy’s DNS servers.

When you click on Manage Domains under the DASHBOARD management page, you will see the following pop-up window providing the details on how to configure:

image

image

As seen above it provides the IP which needs to be used while configuring A records on the DNS server.

Additionally it also suggests that before we add custom domains for the site Azure needs to verify that the user is authorized to use the domain name or not.

HOST

RECORD TYPE

POINTS TO

www.kaushalz.org

CNAME

kaushalz.azurewebsites.net

      

My DNS service provider is GoDaddy so I need to have www pointing to kaushalz.azurewebsites.net. Below is a snapshot of my DNS Manager.

image

 


SCENARIO: MIGRATION FROM PRODUCTION SITE TO WAWS

Now consider a scenario where the user is wants to migrate his production websites to AZURE, without affecting any of his current sites. He would like to perform the verification of the hostname and then would like to modify his DNS records to point to the site hosted on Azure. What should he do?

For this he would have to create CNAME records on the DNS service provider as shown below:

HOST

RECORD TYPE

POINTS TO

awverify.kaushalz.org

CNAME

awverify.kaushalz.azurewebsites.net

awverify.www.kaushalz.org

CNAME

awverify.kaushalz.azurewebsites.net

 

I’m going to point both kaushalz.org and www.kaushalz.org to kaushalz.azurewebsites.net. Therefore I’m adding the above entries.

Note that kaushalz.org and www.kaushalz.org are 2 different hostnames. The above step is only for verification.

Below is a snapshot of my configuration from GoDaddy. I don’t need any other records apart from these 2 CNAME entries.

image

NOTE: I have seen cases where the propagation of the DNS entries takes up to 48 hours or sometime even more than that. In these cases you may have to wait for the propagation to succeed and then do go back to azure and then perform the verification. The user needs to ensure that the awverify entry resolves to the corresponding entry which has been added in the DNS server when performing a look up.

There are online DNS Query tools. I am using dnsquery.org for this. Provide the hostname awverify hostname and then click on query. it will produce results as shown below.

imageIn case of GoDaddy I have always observed that the propagation is very quick and the results are almost immediate.

You can skip this, if you have an CNAME entry pointing to SITENAME.azurewebsites.net on the DNS server.

 

DNS VERIFICATION LOGIC

The WAWS verification logic has 2 steps:

  1. First we try to validate using CNAME. That means we look whether the custom domain provided is a CNAME record. If it is, then it is expanded. If the next record in the chain is also a CNAME, it is further expanded. The expansion goes on until we get an A record or something ending with “azurewebsites.net”. If it is found that the custom domain is eventually pointing to  SITENAME.azurewebsites.net, it is verified that the SITENAME is really the site for which the custom domain is being added and verification is done.
  2. If for some the validation of the CNAME failed, it proceeds with alternative validation. That is useful for users when they want to just test their sites, but not really point the record to AZURE, or if it is a naked domain (some DNS registrars don’t support a CNAME for such hostname). The alternative validation puts “awverify” in front of the provided hostname and follows up the similar logic as above. The only difference is that this time the target has to be the awverify.SITENAME.azurewebsites.net.

TXT records are also supported. It is another alternative, because some DNS registrars don’t support CNAME’s pointing to invalid hostnames (the “awverify” version doesn’t truly exist). So one can also create just a TXT record instead of a CNAME (otherwise it is completely same setup as in validations above).

Thanks to Petr Podhorsky (DEV on WINDOWS AZURE WEB SITES) who shared the above information with me.


Add the Domain Name in WAWS Portal

Lets assume the DNS records have propagated successfully, now the only task is to add the domain name to the portal.

Go to the DASHBOARD Management page and click on MANAGE DOMAINS at the bottom of the page.

Enter the domain name and give it some time to verify. If it succeeds, then you would see something as shown below:

image

If the verification fails then you would get a corresponding warning message that it was unable to perform the 2 step verification logic and would request the user to update the DNS entries.

image

You will have to try resolving the hostname and confirm that it is resolving to the entries you specified.

As I suggested earlier, go to dnsquery.org and query the hostname and see what does the hostname resolves to. This will indicate whether the propagation of entries has been done or not.

Once the verification is done, user can modify the DNS entries to point to the AZURE front end IP Address provided to him. Below is a snapshot of the final configuration of my domain name on GoDaddy.

image


***MORE INFORMATION***

NOTE: You will have to add both www.SITENAME.com and SITENAME.com in the portal as they are 2 different hostnames. Below is a snapshot:
image

Once added successfully you are ready to go. Browse the url’s to confirm the site’s availability.


Viewing all articles
Browse latest Browse all 29128

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>