Mapping a custom domain (e.g., yourdomain.com or api.yourdomain.com) to an Azure App Service involves adding domain bindings in Azure, configuring DNS records at your registrar, and binding an SSL/TLS certificate.
Technical Overview & Architecture
User Request ──> https://api.yourdomain.com
│
▼ (DNS Registrar - CNAME / A Record)
your-app.azurewebsites.net
│
▼ (Azure App Service Front-End)
Azure App Service Plan (B1 or higher)
Target Host Service: Azure App Service (
your-app.azurewebsites.net).Prerequisite Plan: Basic (B1), Standard (S1), Premium, or Isolated tier. (Custom domains are not supported on the Free/Shared tier).
Domain Registrar Access: Ability to edit DNS zone records (GoDaddy, Cloudflare, Namecheap, etc.).
Step 1: Upgrade App Service Plan (If on Free/Shared Tier)
Log in to the Azure Portal.
Search for and select your App Service (e.g.,
your-app).In the left navigation menu under App Service Plan, click Scale up (App Service plan).
Select Basic B1 (or higher) and click Apply.
Step 2: Get Domain Binding Parameters in Azure
In your App Service left menu, click Custom domains (under Settings).
Click Add custom domain.
Select your provider type (typically All other domain services).
Enter your custom domain name (e.g.,
api.yourdomain.comoryourdomain.com).Choose Domain record type:
Use CNAME for subdomains (e.g.,
api.yourdomain.com).Use A Record for root domains (e.g.,
yourdomain.com).
Azure will display the required DNS records for validation:
Domain validation ID (Custom Domain Verification ID): A
TXTrecord token.Host / CNAME Target:
your-app.azurewebsites.net(or the IP address for A Records).
Step 3: Configure DNS Records at Your Registrar
Log in to your DNS registrar (e.g., GoDaddy, Namecheap) and create the validation and routing records.
Option A: Mapping a Subdomain (api.yourdomain.com) via CNAME
Add the following two records to your DNS zone file:
| Record Type | Host / Name | Value / Destination | TTL | Description |
|---|---|---|---|---|
| CNAME | api | your-app.azurewebsites.net | 600s / 1 Hour | Routes traffic to Azure |
| TXT | asuid.api | YOUR_AZURE_CUSTOM_DOMAIN_VERIFICATION_ID | 600s / 1 Hour | Validates domain ownership |
Join the conversation! Your thoughts help the community grow.