Skip to main content Explore View all products (200+) Microsoft Foundry Azure Copilot GitHub Copilot Azure Kubernetes Service (AKS) Azure Cosmos DB Azure Database for PostgreSQL Azure Arc Microsoft Fabric Linux virtual machines in Azure Foundry Models Foundry Agent Service Foundry IQ Foundry Tools Foundry Control Plane Observability in Foundry Control Plane Azure OpenAI in Foundry Models Azure Speech in Foundry Tools Azure Machine Learning View all databases Azure Cosmos DB Azure DocumentDB Azure SQL Azure Database for PostgreSQL Azure Managed Redis Microsoft Fabric Azure Databricks Linux virtual machines in Azure Windows Server on Azure Azure Functions Azure Virtual Machine Scale Sets Azure API Management Azure Container Apps Azure Kubernetes Service (AKS) Azure Kubernetes Fleet Manager Azure Container Registry Azure Red Hat OpenShift Azure Container Instances Azure Container Storage Azure Arc Azure Local Microsoft Defender for Cloud Azure Monitor Microsoft Sentinel Azure Migrate View all solutions (40+) Cloud solutions for small and medium businesses Cloud migration and modernization center Data analytics for AI Azure Databases AI apps and agents Microsoft Marketplace Microsoft Sovereign Cloud AI apps and agents Responsible AI with Azure AI Infrastructure Data analytics for AI Machine learning operations (MLOps) Low-code application development on Azure Integration Services Serverless computing DevOps Migration and modernization center .NET apps migration Databases on Azure Linux on Azure Oracle on Azure SAP on the Microsoft Cloud Adaptive cloud High-performance computing (HPC) Infrastructure as a service (IaaS) Resiliency Azure Essentials Frontier Accelerate for Azure FinOps on Azure Microsoft Marketplace Azure pricing overview Create an Azure account Free Azure services Flexible purchase options Pricing calculator FinOps on Azure Maximize ROI from AI Azure savings plans Azure reservations Azure Hybrid Benefit Virtual Machines Azure SQL Microsoft Foundry Microsoft Fabric Azure Kubernetes Service (AKS) Microsoft Defender for Cloud View more Software Development Companies Microsoft Marketplace Find a partner Resources for Azure partners Get started with Azure Customer stories Analyst reports, white papers, and e-books Videos Learn more about cloud computing Documentation Explore Azure portal Developer resources Quickstart templates Resources for startups Developer community Students Azure for partners Blog Events and Webinars Learn Support Contact Sales Get started with Azure Sign in

This post was written by Michael Candido, Software Development Engineer on the Azure Web Sites Team

Some web applications have a need to use multiple subdomains and certain situation also require dynamically adding new ones. For example, consider a multi-tenant web app that gives each user his own subdomain for a personal content stream or dashboard.

Many users felt that the process for this was complicated, as the user would need to add each subdomain individually through the portal, PowerShell cmdlets, or (more realistically) direct API calls. In case SSL is needed, it adds yet another layer of complication as each subdomain would require an individual SSL binding.

To address this, we have recently introduced the use of wildcard domains. With this, you can add a wildcard domain such as *.contoso.com, which would allow users to access the site using any subdomain (, admin.contoso.com, etc).

The process of adding a wildcard domain to a site is almost exactly the same as for adding regular domains. To illustrate this, we will walk through adding the wildcard domain *.lovelyazuresky.com to the site myazureblog.

1. The first step is to create a CNAME record with your domain provider, which will resolve the URL a user types in to Azure Websites, and will also be used by Azure Websites for verification of the domain ownership(***). To do so, edit your DNS zone with your DNS provider, and create a * record for your domain (lovelyazuresky.com) that resolves to your Azure Websites URL of myazureblog.azurewebsites.net. The management interface used by various domain providers differs, but this is how it would look like on GoDaddy’s domain management system:

graphical user interface, text, application, email
picture of a security disclosure

2. Before proceeding to the next step, use the NSLOOKUP utility or PING to confirm that your wildcard domain resolves to Azure correctly (as in, any subdomain under lovelyazuresky.com would resolve to an Azure URL similar to the below). If it doesn’t, wait a while and try again. Until the record resolves correctly, you will not be able to proceed.

text

3. The next step is adding the domain to the site configuration in Azure, as seen below:

graphical user interface, text, application

Since you already configured the CNAME record, the verification should succeed and the checkmark on the right would appear to confirm it. If you receive an error, give it a little time – it could take up to a few hours for the DNS record to be created with some domain providers. If after a few hours you still cannot add the domain, contact Microsoft support for help.

After the configuration is saved, the domain is ready for action, and all first-level subdomains of lovelyazuresky.com will point to the site.

Adding SSL

If you also want to add an SSL binding to the wildcard domain, the certificate must be a wildcard certificate to cover the full breadth of the wildcard domain. Both SNI SSL and IP SSL bindings are supported. When everything is done, the SSL configuration will look like the image below.

graphical user interface, text, application, email

What if we want to use a different binding and certificate on one or more of the subdomains? This can be done in a natural way by adding (for example) payments.lovelyazuresky.com to the site and creating an SSL binding on it, which for this subdomain will override the wildcard binding on *.lovelyazuresky.com. You can even do this across multiple sites, allowing specific subdomains to go to a totally different site with a different SSL binding.

WE ARE MICROSOFT

Explore Microsoft Foundry

The future of AI starts here. Envision your next great AI app with the latest technologies. Get started with Azure.