Mapping a wildcard domain name to an Azure App Services

May 10, 2022 by Anuraj

Azure AppService

This post is about how we can map wild card domain to Azure App Service. Why we need to map wild card domains? When we are building SAAS applications it is a good practice to provision the tenants with your application sub domain. For example in case JIRA, when you create an instance your instance will be https://instance-name.atlassian.net/. And you need wild card SSL as well for running the instance of HTTPS.

For mapping a custom domain, open your app service, select the custom domain option > and then select the Add custom domain option.

Add Custom domain

For a subdomain you can provide the name in the textbox and click on validate. This will show two DNS records one CNAME and one TXT record. We need to update these records in the domain name provider DNS records settings. I am using a domain which I bought from Google Domains - I recommend Google Domains because it is pretty fast on update DNS records. For wild card domain mapping in the input field we need to set the url as *.domain.name. I am setting up a domain *.anuraj.dev. When we click on Validate button, Azure will display a TXT record and CNAME record.

Add Custom Domain

Next we need to open Google Domains > DNS. Then click on the Manage Custom Records. And add the CNAME and TXT record values from Azure. Once it completed, it will be something like this.

Google Domain - Manage custom records

Once it is update the DNS records, we can click on the Validate button - if DNS records updated, the Add Domain button will be enabled and we can click on the button. Now we are ready to add any domain under this domain, like hello.anuraj.dev or support.anuraj.dev etc - without configuring anything differently.

Configuring wild card domains will be useful when you’re provisioning custom domain name programmatically.

Happy Programming :)

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub