Creating a Web Site in Azure With a Custom Domain Name


Click here to change the theme.

Azure is very powerful; there is very much we can do using it. Since it is so powerful it is complicated and difficult to use. The following instructions are not as complete as they should be but I hope they help.

This describes how to create a web site in Azure using a custom domain name and Azure DNS. See Azure App Service and its impact on existing Azure services that explains that what most people call a web site, Microsoft calls then Web Apps; specifically it says "App Service is strictly limited to changing the name Websites to Web Apps".

Also, Microsoft uses the term "custom domain name" whereas most every other hosting service would just say domain name. That is because the web site exists as a subdomain of azurewebsites.net and then we point our (custom) domain name to that. So in other words, we must have a Web App (web site) at somename.azurewebsites.net where somename is a name you choose (it must be something that no one else has already chosen). Microsoft allows us to create up to 10 Web Apps for free as subdomains of azurewebsites.net however if we want to use a custom domain then we must pay approximately $10 (or more) a month. See Pricing - App Service | Microsoft Azure; a Shared plan is about $10. Also see Pricing Calculator | Microsoft Azure; click "App Service" to add one to the estimate then scroll down. One App Service of the "Shared" tier is about $10 a month, however that includes as many domains as we wish.

Microsoft does not provide an email server, at least not for their most economical plans (shared hosting), whereas most other hosting services do. SendGrid is often suggested as an solution but it is not; it only sends email. If you hunt you can find other services and I am currently researching what could be used.

Also, Microsoft does not sell domain names; you need to purchase a domain from a registrar other than Microsoft. In Azure for your Web App when you go to "Custom Domains and SSL" there is an icon for "Buy Domains" however the registrar for that is GoDaddy.

When a domain name is purchased from the same company that hosts the web site (and the accounts are the same) the registrar / hosting service can manage the DNS for the domain. When the registrar and hosting company are different, as in the case of web sites hosted by Azure, we must configure the domiain (the Domain Name System (DNS)) ourselves. Azure has a new feature (I say new because at the time this is written it is still in Preview mode) called Azure DNS. The initial announcement is Azure DNS and DNS | Microsoft Azure is the current announcement. See Overview of Azure DNS | Microsoft Azure for a general description using minimal technical terminology.

I will briefly explain what Azure DNS is and compare it to the other way for configuring the DNS. The internet locates web sites, email servers and other services associated with a domain name using DNS. The details, such as actual IP addresses, are in a "zone" that consists of specific "records". The collection of records are often called a "Zone File" but the official decriptions of them (see RFC 1035 - Domain names - implementation and specification and its revisions) do not call them Zone Files. The most commonly known type of records of a zone are IP Address ("A")  and Domain Name Alias ("CNAME") records. "Name Server" (NS) records are also commonly known; they often are considered to be separate but they are records of the "zone". If we configure a domain that is to be used as a custom domain for an Azure Web App and we do that using Azure DNS then we only need to specify the Name Servers in the domin name registration (the registrar). All the other DNS records are in a zone file in Azure. If we configure a domain that is to be used as a custom domain for an Azure Web App without using Azure DNS then all the DNS records (A records and CNAME records) are in the domain registrar's system.

The general procedure for creating a web site in Azure with a custom domain name is:

  • Create a Web app in Azure if you have not already
  • Create a Web Site using any of the following:
    • Visual Studio and deploy using either Web Deploy or FTP
    • Expression Blend and upload using FTP
  • Purchase a domain name if you have not already
  • Create a DNS zone in Azure DNS
  • Configure the DNS zone (including "bring")

Create a Web app in Azure

There are many ways to create a Web app in Azure. From the Pricing Calculator | Microsoft Azure you can create whatever service you have chosen. Or you can go to the Portal. Assuming you have an account and are signed in, click "+ New" in the upper left.

Whether you are creating the Web App by going through the Pricing Calculator or by going to the Portal directly, if you want to create a web site using pre-existing web app software then you can choose the application from "Marketplace". Otherwise, below the Marketplace section, click "Web App". If you intend to use a custom domain name for your web site, you still must create it as a subdomain of azurewebsites.net as previously described. So enter your subdomain name in "App name". Azure will tell you if the name is not available. For Subscription if you will be using a custom domain name then you cannot use the "Trial" subscription. So you will need to create a new subscription if you only have a Trial subscription and you will probably need to create a new resource. For me, my paid subscription is a "Pay-As-You-Go" subscription.

Once the Web App has been created, from the Dashboard in the Azure Portal go to your Web App. In the right there will be a list of Settings. Look for "Custom domains and SSL" under "Routing" near the bottom of the list. At the top of "Custom domains and SSL" is an icon for "Bring External". When you click it, Azure will show you the IP address of where the web site is.

Create a Web Site

If you use Visual Studio then you can create a web site using it then deploy (publish) it using Web Deploy. See the tutorial series beginning at Deploy an ASP.NET app to Azure App Service using Visual Studio. It shows very much, beginning with setting up Visual Studio 2015 with the Azure SDK for .NET.

If you are interested in a very thorough tutorial about ASP.NET Web Deployment using Visual Studio (including databases), there is a 12-part series beginning at ASP.NET Web Deployment using Visual Studio: Introduction | The ASP.NET Site.

If you use Expression Web or most any HTML editor then you can create a web site using it and uplaod (publish) it using FTP.

Alternatively, there are very many pre-existing web apps that might be what you need. Microsoft has very many available that can be easily installed by Azure, such as WordPress, Umbraco CMS, Drupal, DNN (formerly DotNetNuke), Django, osCommerce, Photo Gallery and very many more. In addition to Umbraco, Drupal, DNN and Django, there are about 30 CMS web apps.

Purchase a domain name

Theare are many places to purchase a domain name. Look at the list ICANN | ICANN-Accredited Registrars; as you can see, there are many accredited registrars. If you purchase one form within Azure then the registrar is actually GoDaddy. I use Google Domains but there are many others to choose from.

Create a DNS Zone

You can first create your web site in the azurewebsites.net subdomain then point the custom domain to it and then you are all set. To use Azure DNS to do that, from the Portal click "+ New" in the upper left then in the bottom of the list click "DNS Zone". Currently it says "DNS Zone (preview)". Then enter the domain name for the Name. Select the subscription, create a new resource or use an existing one and select a resource group location (the default for resource group location is probably the best). It is not clear when we should create a new resource or when to use an existing one. My DNS Zone is in my "Pay-As-You-Go" subscription.

After crdeating the DNS Zone, you will need to update your domain name registrar with the nameservers so that the domain name points to (the Azure articles say "delegate to", as in "delegating a domain to") Azure. The nameservers are specified in "NS" records but most registrars have a special place for specifying the nameservers. To determine the nameservers to be used for your web site, go to the settings for the Zone File. You will see somethig such as:

The nameservers you see in your Zone file settings are the ones you need to specify for your domain name in the registrar for it.

Configure the DNS zone

Next you need to create the "A" record in the Zone File and then two CNAME records. The first CNAME record is an "awverify" record and the other one is a "www" record.

The following is a summary of what the Zone File should be. The "<yourwebappname>" is from the web app you created in Azure, as in <yourwebappname>.azurewebsites.net.

NameTypeValue
@A13.65.97.243
awverifyCNAME awverify.<yourwebappname>.azurewebsites.net
wwwCNAME<yourwebappname>.azurewebsites.net

So the Zone File for this web site is:

For your security, those CNAME records need to to propagate through the DNS system before you can proceed with the following.

In the Azure Portal, go to the settings for your web app (as in "<yourwebappname>"). In the Custom domains and SSL blade (under "Routing"), click Bring External domains. Enter your domain name into the box near the bottom. It will look something like:

Be sure to click "Save" at the top.