Custom domains for web pages hosted on Azure App Services
Tags: webdev, azure
Published: 2020-01-21 21:31:07

If you are thinking of creating your own website, you have probably heard of the word "domain," but do you know what it means?

The domain is a name that identifies a website on the Internet. Its fundamental purpose (along with the Domain Name System (DNS)) is to translate IP addresses into terms that are easier to memorize and find. That is, more simply, the domain corresponds to your Page's link. For example, for the case of this article, our tutorial is under the domain dev.to. Choosing a good domain is very important, as it will be access to your website. This, preferably, should be formed with the name of your company, and if you want with the category of it, as it will help you to position your website more easily.

Currently, there are a lot of services that provide domains on the Internet, in this case, we will learn how to buy a domain in Azure and associate it with a web page that we have hosted through the Azure App Service resource.

##Buy the domain##

In the Azure portal, we need to find the App Service Domains resource and then click Add to register a new domain.

To purchase the new domain, we need to provide the following information:

![](https://thepracticaldev.s3.amazonaws.com/i/ab3zrgbdx5zq2seyu1v3.png)

+ **Domain name**: In the Search domain box, we need to enter the domain name we want to purchase. Suggested available domains are displayed just below the text box. In this case, you can select one or more domains to purchase later.

+ **The azure subscription**. This will be the subscription with which we will purchase the domain.

+ **The contact information** of the person responsible for the domain.

+ **Accept the legal terms of service**. The cost of the domain is detailed in this section. This value will be deducted from available Azure credits.

![](https://thepracticaldev.s3.amazonaws.com/i/cat49zogdvft05pettf9.png)

Finally we click in Create. The domain acquisition process takes 1-3 minutes to complete.

![](https://thepracticaldev.s3.amazonaws.com/i/f0k0s1lznhuybf3x8kou.png)

##Assign the new domain to a page hosted on Azure App Services##

####Change the resource plan####

As a first point, we should be aware that our app in Azure App Service must have a plan that allows you to associate custom domains. To do this, within the App Service menu bar in the Settings section, we go to: Scale up (App Service plan)

![](https://thepracticaldev.s3.amazonaws.com/i/ojm6xfrcq7l4ge0czbaq.png)

In this section we need to select a payment plan that allows you to associate custom domains. After performing this process, we save the changes to the Apply button.

####Add the custom domain####

Then, within the same Configuration section in the App Service, we go to the Custom domains option.

Here, we click Add custom domain:

![](https://thepracticaldev.s3.amazonaws.com/i/9ng53hceznup68gpzvt5.png)

The resource will then ask us to specify the custom domain:

![](https://thepracticaldev.s3.amazonaws.com/i/mgoxmd9zsvwggy1t4n6h.png)

Then we click Add custom domain, and with this we would already have associated our new custom domain with the web page hosted in Azure App Service:

![](https://thepracticaldev.s3.amazonaws.com/i/0msyrz77gab2b6slg49i.png)

####The result...####

From now on, we can access our website with the domain created and also with the .azurewebsites.net address that was previously had.

![](https://thepracticaldev.s3.amazonaws.com/i/1d4nieezwyto58176hhv.png)

##What's next?##

With these steps, we learned how to associate a new domain with an existing web page hosted on a resource with Azure App Service. 

Want to learn more? Here are some tutorials that could be of great help to you:

+ [Hosting a Static Website on Azure Web App!](https://dev.to/esdanielgomez/hosting-a-static-website-in-azure-web-app-3oog).
+ [Continuous Deployment on Azure with Visual Studio 2019 and GitHub](https://dev.to/esdanielgomez/continuous-deployment-on-azure-with-visual-studio-2019-and-github-1lg8).
+ [Steps to create an MVVM application (Model-View-Viewmodel) with DotVVM and ASP.NET Core](https://dev.to/esdanielgomez/steps-to-create-an-mvvm-application-model-view-view-model-with-dotvvm-and-asp-net-core-fm2).

See you on [Twitter](https://twitter.com/esDanielGomez)!! :)