Using Custom Domains with Windows Azure Services
A colleague of mine from the previous group asked me whether Windows Azure Hosted Service and Storage Account can share the same domain. Currently if you deploy Hosted Service on Windows Azure it will be accessible through an URL with the following format:
http://[servicename].cloudapp.net
At the same time if you create Windows Azure Storage Account, the containers and blobs will be accessible through an URL like this:
http://[accountname].blob.core.windows.net
If you are Web Developer, and plan to develop application for Windows Azure it will be important to have the same domain for both. There are many reasons for that, among which are branding, SEO, Ajax security and so on. Here is how you can achieve this.
Using Custom Domain with Windows Azure Hosted Service
For my test purposes I deployed the Hello World app that comes with the Windows Azure SDK samples. The URL of my Hello World Web app provided by Windows Azure was:
After that I went to my registrar’s Web site and created CNAME that points to the above URL:
http://azureapps.toddysm.com –> http://toddysm.cloudapp.net
Once the CNAME was registered I verified that I am able to access my Hello World using the new URL. Voila!
Using Custom Domain with Windows Azure Storage
Now that I have my Hosted Service accessible through my custom domain, I had to configure my Storage Account to use custom domain too. Steve Marx describes the process in details in his post Using the New Windows Azure CDN with a Custom Domain. I skipped the CDN part but went through the remaining steps for configuring custom domain. Unlike the configuration for the Hosted Service, the Storage Account requires verification by Windows Azure. Hence you need to go through a couple of more steps.
The endpoint URL for my storage account provided by Windows Azure was:
http://toddysm2.blob.core.windows.net
You can find this information on Windows Azure Developer Portal when you click on your storage account. At the bottom of the page is also the section for configuring custom domain:
Clicking on Manage forwards you to the configuration page:
You need to type your custom domain and generate a key, which you use to create a CNAME that points to:
domainverification.windows.azure.com
You create the CNAME with the special key on your registrar’s Web site. Once the CNAME is created you click on the Validate button at the bottom of the page. If you registrar takes too long to create the CNAME you can return to the Storage Account summary page and you will find link to validate the domain in the section Custom Domains:
Once you have your domain validated you can create the actual CNAME at your registrar’s web site. In my case this was:
http://azurestorage.toddysm.com-> http://toddysm2.blob.core.windows.net
And, of course you need to test whether everything works as expected. For my test purposes I uploaded sample HTML file into my storage account and allowed public access to the container.
Now both, my Hosted Service as well as my Storage Account use the same top level domain.
Advertisement

