Hi Everyone!

This post is continuation of a series about Azure App Service Environment (ASE v2). Over the time, I will updated this page with links to individual posts :

Deploy App Service Environment in Microsoft Azure

Create a WebApp in App Service Environment

Access App Service Environment Hosted WebApp from Azure Network and from On-Prem

Deploy a WebApp with Azure Sql in App Service Environment using Managed Identity and Private endpoint

This Post - Add Custom Domain for App Service Environment Hosted WebApp

In the previous post we have migrated a webapp in App Service we are able to access it using subdomain of ase environment.However, our requirement is to set custom domain to access the website. However we will still use ase subdomain to access kudu. Let’s get started.

We will assume, Business wants to access the website using https://demoapp.internal.xyz. If you already have internal.xyz DNS zone in your own DNS server then you can just add demoapp as CNAME that points to sandbox.intranet.appserviceenvironment.net else create a DNS zone and after that add CNAME.

But, in our case we don’t have On-prem DNS Server, however we have DNSForwarder, which forwards all request to Azure DNS. So, in our case we can create a Azure Private DNS Zone.

In this post, I am using Azure Portal to create Private DNS Zone. However, Please check this post for how to create using Powershell. Private DNS Zone

Since, hub-vnet in our entry point to our Azure environment, we will link our newly created zone with it.

Link to Hub Vnet

At this point you can either create a CNAME or A Record in this zone, both will work. Please remember you will not be able to configure both using same name. You should implement either of it. My preference is to go with A Record.

To Configure CNAME

Create a CNAME which will point to sandbox.intranet.appserviceenvironment.net. To do that go to to your DNS Zone dashboard and Click on + Record Set and enter below details :

Name : demoapp

Type : CNAME

TTL : 1

TTL Unit : Hours

Alias : sandbox.intranet.appserviceenvironment.net

Configure A Record

To Configure A Record

Create a A Record which will point to your ASE ILB IP. To do that go to to your DNS Zone dashboard and Click on + Record Set and enter below details :

Name : demoapp

Type : A

TTL : 1

TTL Unit : Hours

IP Address : 10.20.30.11

Configure A Record

You are all set in terms of DNS settings. If you try to access the site now, you will still not be able to access it because your sandbox webapp does not know about your domain and the way it works is based on Host header.

So the only left part is to re-configure your webapp. Go to settings and click on Custom Domain. Click on Add custom domain and enter demoapp.internal.xyz, Click Add custom domain.

Configure Custom Domain from WebApp Settings

After configuring, it will show as per below image -

After Configure Custom Domain from WebApp Settings

To access your app using new domain demoapp.internal.xyz, go to your on-prem system from where you were testing previously and Hooray!! site is now accessible.

Site is accessible using custom domain

But Wait! did you noticed that the webapp is not using https? which is one of our Business requirement, right? We will fix the issue some day!