For the last few days, I have been questioned by many of my followers on how to point our own domain in Windows Azure. Once we designed and deployed our application to the Windows Azure environment we will be provided with a custom domain i.e. <MyApplicationName>.cloudapp.net now we need to change it to a custom domain of our own say www.f5debug.net or some other domain of your choice we need to have a way we can redirect the application URL to the domain we purchase from the Domain registrar companies.
Custom domain mapping can be done with 2 ways basically with any type of environment, but with Windows Azure its always better to go with CNAME mapping rather than assigning A Record. [more]
- CNAME Mapping
- A Record
CNAME Mapping: With CNAME we can map a custom domain such as www.f5debug.net or blog.f5debug.net to point to the cloud application which we deploy to the Windows Azure. When we deploy an application to windows azure we will be provided with a custom domain by default but it will be a prefix of cloudapp.net so our application looks like f5debug.cloudapp.net. If we want to map to our own custom domain in Windows Azure then CNAME is the best option.
A Record: A Record is also a type of mapping but it uses the Virtual IP to assign and map to the application, but with a scalable Azure Application the Virtual IP’s will keep on changing as it scale and each and every time the instance changes the IP will be changed. So its not advisable to use the A Record in this case.
This was the main reason initially we have mentioned like using CNAME is the best option rather than using the A Record as virtual IP’s are not permanently point to the same application. So let us collect some of the information we need to have before we map our custom domain with the ASP.NET MVC 3 application which we deployed on to the Azure Environment. Login to the Windows Azure account and navigate to the website which we deployed as shown in the screen below.
Navigate to the Dashboard of the application and we can see the below information which are required when we are trying to implement the custom domain mapping as shown below.
Custom Domain Name – www.Karthikoncloud.info (Custom Domain registered)
Type of Mapping – CNAME
Mapping Record Value – f5debug.cloudapp.net
Click on the Site URL and we can see our application as shown in the screen below. This application is now pointing to http://f5debug.cloudapp.net/ which is the base custom domain provided by the Windows Azure.
My custom domain www.karthikoncloud.info is registered with www.godaddy.com and we need to access the Domain Management tool of godaddy to start mapping the CNAME. First access the url www.KarthikonCloud.info and we can see that its not mapped to any of the website and it is registered with godaddy. Now once we login to the Godaddy account we need to navigate to the DNS Manager in the Domain Management System, this will be changing based on the domain registrar as shown in the screen below.
Next step is to navigate to the DNS Manager and we can see the list of options CNAME (Alias) available, we can add up to 100 records where ever required as shown in the screen below.
We can see WWW is pointing to the root @, here we need to edit this record to point our custom domain to f5debug.cloudapp.net as shown in the screen below. If www record is not available we need to add it manually it depends on the registrar we register our domain names.
Now save the record and we can see the message it will take a minimum of 1 hour to get it reflected and at the maximum it can take up to 48 hours to see the changes. Now go back to the domain manager and we can see the forwarding option as shown in the screen below.
We can see the Forwarding is OFF right now, click on Manage to navigate to the forwarding setting option, where we need to map the domain with the specific subdomains in order to use the CNAME properly as shown in the screen below.
Now we are doing with all the mapping and everything is ready. Wait for 1 hour at the minimum and we can see our application is now mapped perfectly with www.Karthikoncloud.info without any issues. This is how we can map any of the domains and subdomains in Windows Azure with the respective CNAMES to the application which are deployed as shown in the screen below.
Hope this is informative article, will continue to post interesting topic on the same in the upcoming articles. Until then keep looking into my blog for more interesting topics and discussions. That’s it for now, bye bye and happy programming!!!