How to: configure custom DNS names for multiple sub domain-based Azure web sites

This blog post shows how to configure multiple custom sub domain names to map to multiple Azure web sites.

Azure web sites supports multiple web sites (and at the moment you can run several free websites in the Azure web sites preview).

When a new site is created it gets a default subdomain name in the “azurewebsites.net” domain, so if you create a web site called “mysite” then it would be available as “mysite.azurewebsites.net”.

domainnamesinfreemode

It is also possible to configure custom domain names for the sites. To be able to use custom domain names the web site needs to be in the shared or reserved web site mode. Neither is free, you can see the current pricing information in the portal. (If you have an MSDN subscription or MPN association with benefits then you might get access to some resources as part of the subscription.)

websitemode

If you have several Azure sites and want to map them to several sub-domains for your custom domain it is possible and quite easy. However, the documentation about this has improvement potential, hence this blog post.

Scenario:

A custom domain “stefanjohansson.org” needs to be mapped to 3 different sites in Azure:

domain name Azure Site Azure DNS name
stefanjohansson.org myplainsite myplaintestsite.azurewebsites.net
test1.stefanjohansson.org my1sttestsite my1sttestsite.azurewebsites.net
test2.stefanjohansson.org my2ndtestsite my2ndtestsite.azurewebsites.net

Custom CNAME records

Step 1 is to set up custom “awverify” CNAME mappings from each domain to Azure for verification so that Microsoft knows that you own/can administer the domain.

Name Type Data
awverify.stefanjohansson.org CNAME awverify.myplaintestsite.azurewebsites.net
awverify.test1.stefanjohansson.org CNAME awverify.my1sttestsite.azurewebsites.net
awverify.test2.stefanjohansson.org CNAME awverify.my2ndtestsite.azurewebsites.net

once the CNAME’s are valid and can be read by Azure you can create A-records for the subdomains so that you can reach Azure using the custom domain names

A Records

Step 2 is to configure A records for the domains and sub domains.

First look up the actual IP-address (faked as 10.10.10.10 below) of the sites in the manage domains page of the Azure management dashboard.

Next, create the custom A records for the sub domain names in your DNS providers dashboard (such as your hosting providers administration panel/tool, your registrars website or your dns tool for internally hosted dns systems.)

Name Type Data
stefanjohansson.org A 10.10.10.10
test1.stefanjohansson.org A 10.10.10.10
test2.stefanjohansson.org A 10.10.10.10

Configure Azure Websites

Step 3 is to configure the new A records in the Azure websites dashboard. The configuration tool checks that both CNAME and A records are valid so it is not possible to add this before the configuration changes in the DNS-system has propagated.

The manage domains link is in the Configure tab of the site in the bottom toolbar as below

managedomainslink

Verification

Once the configuration is done the domain names should be visible in the Azure dashboard and you should be able to navigate to the custom domain name and be able to access your resources in the Azure web sites using your custom domain names.

twodomainnamesconfigured

 

More resources

(Also, please note that the sub domain names, Azure sites and ip-addresses used here are faked.)


Comments

4 responses to “How to: configure custom DNS names for multiple sub domain-based Azure web sites”

  1. […] there was just the usual parts, update the dns configuration to support the new dns name in Azure (http://www.stefanjohansson.org/2012/12/how-to-configure-custom-dns-names-for-multiple-subdomain-base…), update the dns to point to the new host, migrate the content from the old host to the new and […]

  2. This did not work for me.
    I can create the CNAME but not A (Host).
    I receive error that already exists.

    Well, but if I can access the subdomain but leads me to index.php (mysite.com). and not (test.mysite.com).

    Why?

    Sorry, my native language is Spanish.

  3. Hi,
    If you already have an A record for your sub domain you need to verify it points to the right IP. Once that is ok you need to configure the right Azure web site to answer the requests to that address.
    Note that this post references how Azure was working in December 2012. A lot has happened since wrt Azure networking capabilities and possible setup scenarios.

  4. Thank you!
    And configure subdomains.
    My problem now is how to point to a directory espesifico each subdomain.

Discover more from stefan johansson

Subscribe now to keep reading and get access to the full archive.

Continue reading