Adding a custom domain to Azure App Service
Tags: azure, domain, node
Published: 2020-09-27 05:53:59

We created our [Node hosted Azure app](https://daily-dev-tips.com/posts/deploying-a-node-app-to-azure/) and learned how to [auto-deploy from GitHub](https://daily-dev-tips.com/posts/github-automated-deployments-to-azure/).

Today we will be looking at running this on a custom domain.

> Be aware: Custom domains are not on the free-tier, so you'll need to have a paid account for this! 😭

Custom domain names are very important to define your project, it's all cool if it's a demo or testing environment, but an actual app should run on its own domain.

## How to add a custom domain in Azure

First, let's open our App Service and click the `Custom domains` option on the left.

![Azure custom domains section](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774467881/fRlVE4hHG.png)

This will open up the Custom domains menu, and we will be prompted to upgrade out tier if we are on the free tier.

Once you upgrade to a small service, you can click `add domain`.

![Azure add domain](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774551060/YzTj5du7h.png)

Clicking this will open a side drawer on the right, where we can choose our custom domain. In my example, I'm using `azure.daily-dev-tips.com`.

![Azure add domain settings](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774604700/eoQkWhSmw.png)

If you scroll to the bottom, you'll see  the `domain ownership` section.

![Azure domain ownership](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774647449/a-mcbMnqU.png)

These are the settings we need for our domain host.
 
> The txt is optional, it seems, I only did the CNAME, and that worked well.

## Adding the Azure records with your domain registrar

This section is going to be different for wherever your domain is hosted.

My domain is linked to [Netlify](https://netlify.com/), so this might be different than your domain.

Go to your Domain settings.

![Netlify Domain Settings](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774739619/NNdbN8vcI.png)

> Your domain registrar might say something like: "DNS Management"

Now we need to add a DNS record for Azure.

![DNS Record settings](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774801547/fBNbwNiqK.png)

My settings include this:

- Type: CNAME
- Name: azure (azure.daily-dev-tips.com)
- Value: dailydevtips.azruewebsites.net (what Azure gave us)

Save these settings.

Now we need to go back to Azure to verify the domain.

![Azure verify domain](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774872520/Zf5Vn1yYE.png)

We need to do the following actions.

1. Click validate; This will show the `Domain ownership` marked correct
2. Then we need to click the `Add custom domain` button to complete this

And we are done! Go visit your new domain to verify.

![Azure custom domain](https://cdn.hashnode.com/res/hashnode/image/upload/v1600774962178/BgGwGhqMl.png)

> I turned my custom domain off, to not pay for it 😅

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)