When I started using Azure, I used the opportunity to create free websites. For free websites on Azure, the website url will be: http://yoursitename.azurewebsites.net
After playing a lot with Azsure websites, I came to love the setup. Best of all, I find the way Azure integrates with Visual Studio, which is for sure my favorite IDE for development.
I decided to try to make a new website, and use the option for hosting a custom domain on Azure. It proved to be a lot more complicated than creating a simple free website, so for interested people here is a small and hopefully helpful description on how I did it.
Register the Domain
Before you can start the Azure setup, you need to register the domain, you would like for your Azure website. Azure does not offer domain registration, so you will need to find a company offering domain name registration. I use Surftown, but only because I already had an account there. Scott Hanselmann recommends GoDaddy. If it is good enough for him, I guess it would be good enough for you. And comparing the price, I see that Godaddy is a lot cheaper than Surftown.
But well… find a domain name register company, and register a domain.
Create an Azure account
Azure is a cloud computing platform and infrastructure created by Microsoft. If you have an MSDN license, you are given an amount on a monthly basis, which can be used for the different services exposed by Azure. Alternatively you can try Azure for free in a free one-month trial. But be careful – you will be addicted, as Azure rocks!
Here is a link for creating a free one month trial:
Create an Azure website
Ok. You have your Azure account and your domain. Now create your azure website.
When you create a website from Visual Studio, you are given the opportunity to mark a checkbox, with the text “Host in the Cloud”, which will lead the website to be created automatically on Azure. Wow – automatically setting up the site, just by creating it from Visual Studio? YES. Azure rocks.
After creating the website, you will have a very cool looking site working locally, but also already setup on Azure, so it just needs to be published. Having the site live is a click or two away :).
Scale the Azure Website
Log in to Azure, and go your Management Portal.
Click the newly created website, and click the “SCALE” tab:
Custom domains are not available in Free Mode, so you need to scale up a bit.
Click on the “Shared” Web Hosting Plan Mode.
Set A Host and CNAME
First you need to find the IP address of your Azure website. In Azure click your website, click the Dashboard tab and click the Manage Domains button, at the very bottom of the page:
From the pop up window, copy the ip address.
Now log in to your DNS provider’s management page. You will have to set two A Hosts and three CNAMES.
yourdomain points to IP of the site on Azure
*.yourdomain points to IP of the site on Azure
Awverify.yourdomain points to IP of the site on Azure
Awverify.www.yourdomain points to IP of the site on Azure
www.yourdomain points to url to the site on Azure
Manage Custom Domains
Go back to Management Portal in Azure, select your website and click the "Manage Domains" button at the very bottom of the page. Enter two domain names:
yourdomain and www.yourdomain
For the website you are currently looking at, it would be:
mortenempeno.com and www.mortenempeno.com
The Azure Management Portal checks the “awverify” CNAME record, you added in your dns provider management syste,.
If it is accepted, a green circle with a white checkmark in it appears. If it is not accepted, it may be because your settings from the dns provider is not effectful yet. - double check your settings and set the ttl (time to live) as low as possible, for the changes to be effectful as early as possible.
That's it, dude. Check out your custom domain. It should work now, with and without www.
Please feel free to reach out, if my description did not work for you. I will be happy to receive feedback to improve the guide.