The Web Apps feature of the Microsoft Azure public cloud lets you create and deploy web and mobile apps that can scale with the growing needs of your business or organization. Web Apps was formerly called the Websites service and is now branded as a feature within the Azure App Service. This new branding is more appropriate because most websites today are dynamic web applications and not static web content anymore, plus they also need to be designed to display and function on a variety of different devices including PCs, laptops, tablets and smartphones. To find out more about Web Apps see this page on the Microsoft Azure site.
But once you’ve created your web application, you may want to associate it with a domain name that your company or organization owns. To guide us in how to accomplish this, I’ve asked my colleague Danny Hermans to provide us with a step-by-step walkthrough of the process. Danny is a freelance Infrastructure Optimization Architect based in Sweden, with almost 20 years of experience in various consulting projects, ranging from greenfield design over optimization to migration assignments. Since joining Microsoft in 2012, he has been a Senior Premier Field Engineer (PFE), Tech Lead, Risk Assessment Program (RAP) as a Service Developer for Operations Manager and a Senior Partner Technical Advisor for System Center. Throughout his career, Danny has developed a love of fine-tuning Microsoft products and seeks to enhance performance wherever possible to add value to his customer outcomes. I previously worked with Danny as the Series Editor for the free ebook Microsoft System Center Operations Manager Field Experience (Microsoft Press, 2015) which he co-authored with Uwe Stürtz and Mihai Sarbulescu and which you can download from this page on the Microsoft Virtual Academy site. Danny can be found on LinkedIn at https://www.linkedin.com/in/dannyhermans and on Twitter at https://twitter.com/thetuningguy. Be sure also to check out his website http://www.est8.se for EST8 Consulting AB, a premium provider of Infrastructure Optimization Services based in Sweden that helps companies use Microsoft System Center and Microsoft Azure technologies to bring your infrastructure to the next performance level. Let’s now hear from Danny as he explains what’s involved in associating your own domain name with an Azure Website.
How to associate your own domain name for an Azure Website
I know this has been explained already on the Azure documentation, and technically very well at that actually, but I still would like to show you in my own words how to do this, as I did it for my own new website. I’m an infrastructure guy, not a web developer — even though I have my MCSD: Azure Solution Architect — and it is really easy to do!
So you have made your first Azure website, which is called Web App in Azure. There are many possible ways to create a Web App, I have made mine in Notepad/Notepad++ and the graphics were created with Paint.NET — two of the best free programs ever made! Please support the creators if you use their product.
The site itself is just a few HTML pages, one CSS style sheet, some graphics and a PDF file containing my resume. Nothing fancy, but it does the job it is supposed to do. Making a website in WordPress, one of the many options when creating a Web App in Azure, would probably have a bigger wow-factor but then again that is not (yet) what I needed to accomplish.
From the current Azure portal, you can install WebMatrix which enables you to copy files to your Azure Web App. This can be done by going to Web Apps at the left side of the screen and clicking the WebMatrix icon at the bottom of the screen, as shown in Figure 1. You can also use Visual Studio or other content management tools to accomplish this.
Figure 1: Click the WebMatrix icon at the bottom of the screen to install it
Once WebMatrix is installed, you can open your Azure Web Apps from there by clicking on File/Open/Windows Azure as shown in Figure 2. Yes this is still something that Microsoft has to rename since it is Microsoft Azure and no longer Windows Azure.
Figure 2: Using Microsoft WebMatrix to get access to your Azure Web Apps
You can then copy the HTML, CSS, and other content files to your Azure Web App and voila, your first Web App is up and running for everybody to see. Nice and easy!
The URL of your Web App will be yourname.azurewebsites.net — an okay URL for your own personal website, especially since you can choose to have your Web App in the Free App Service Plan. This is actually the default when you create a new App Service Plan, as shown in Figure 3.
Figure 3: A newly created Web App using Quick Create and Create New App Service Plan
However, if you want to use your own domain name, like www.est8.se, then you have to do some changes.
For starters, you might need to change the pricing plan of your Web App if this site was created in the Free App Service Plan (which is the default). This can be done by going to Web Apps on the left side in the Azure portal. From there, you click on Scale once you have opened the Web App for which you need to change the App Service Plan and the pricing linked to the App Service Plan. This is shown in Figure 4.
Figure 4: Showing the Scale tab where the App Service Plan pricing tier can be changed from Free to Shared, Basic or Standard
This has to be done because linking your own domain name is only available for the Shared, Basic and Standard modes for Web Apps as shown in Figure 5.
Figure 5: Custom domain names, SSL bindings and certificates cannot be used in free mode
Before switching a Web App from the Free mode to the Shared, Basic or Standard mode, you must first remove spending caps in place for your Web Apps subscription. Remember that you might have more than one Web App in this App Service Plan, and if you change it from Free to a paying model you will incur costs on all of the Web Apps in this App Service Plan.
If you are expecting a lot of traffic to your new Web App (of course you are expecting that!) then you will need to change the App Service Plan to Standard. With a Web App in the Standard App Service Plan you can configure auto scaling. Autoscale can be set at scheduled times (for instance, when you expect a lot of traffic for an event you are organizing) or it can automatically scale if the target CPU utilization of the webserver is going over a preset limit. This is shown in Figure 6.
Figure 6: Once the Standard App Service Plan is chosen, you get the option to configure automatic scaling of your Web Apps according to schedule or metric
Once the App Service Plan has been changed to Shared, Basic or Standard mode, you can start with your own domain name. Unless you need HTTPS (using SSL certificates and bindings) the Shared mode is sufficient. By clicking on Configure when the Web App is selected, you can go to Domain Names and click on Manage Domains. There it is explained that you need a CNAME record from your provider, as shown in Figure 7. In Figure 7, this CNAME record is not created yet, giving a red exclamation mark as the error.
Figure 7: A CNAME record is needed to verify that you are the rightful owner of the domain
This is the only thing your domain provider needs to do — you need to prove to Azure that you are the owner of that domain name, and the way to do that is to create a CNAME record in DNS pointing your own domain to the Azure Web App.
So in my case, the provider created a CNAME record that pointed www.est8.se to est8.azurewebsites.net. Mind you this might need some time to propagate before the Azure DNS servers pick up the new CNAME record. In my case it took less than 5 minutes. Depending on the TTL set by the provider this might take longer.
Once that record is created, you need to configure the custom domain name in Azure. This will fail until the CNAME record is created and the record has propagated through to the Azure DNS servers. If the CNAME record is not found, you will get an exclamation mark when you put in your custom domain name, saying the CNAME or the AWVERIFY records cannot be found, as shown in Figure 7. If the correct record is found no error message is displayed and the custom domain name is accepted, as shown in Figure 8.
Figure 8: The CNAME record for www.est8.se has been created by the provider and is now accepted by Azure.
As also shown in Figure 8, the www.est8.se gets accepted by Azure since the provider created a CNAME record for the www part. The root domain est8.se does not get accepted. This means that www.est8.se points to est8.azurewebsites.net but est8.se does not.
In the Web Apps overview screen, you will also notice the new URL that is shown — your own domain name! The yourname.azurewebsites.net URL also still works. This is shown in Figure 9.
Figure 9: Showing the Web Apps main overview screen with the newly configured Web App using a custom URL and another Web App using the default URL
And that’s all there’s to it. Easy as 1-2-3:
- Get your website ready and upload the content to Azure Web Apps
- Ask your provider to create a CNAME record pointing your domain name to your Azure website URL
- Have Azure verify this CNAME record to confirm you are the owner
Got questions about Microsoft Azure?
If you are new to Microsoft Azure or have questions or problems with any of its features or services, two good places to ask questions and get help are the Azure forums on MSDN and on Stack Overflow where you will need to tag your question with the keyword Azure. For more information about these two free support options, see here: https://azure.microsoft.com/en-us/support/forums/