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 |
Option B: Mapping a Root Domain (yourdomain.com) via A Record
Add the following two records to your DNS zone file:
| Record Type | Host / Name | Value / Destination | TTL | Description |
|---|---|---|---|---|
| A | @ | YOUR_AZURE_APP_SERVICE_IP | 600s / 1 Hour | Points root domain to IP |
| TXT | asuid | YOUR_AZURE_CUSTOM_DOMAIN_VERIFICATION_ID | 600s / 1 Hour | Validates domain ownership |
Step 4: Validate and Add the Domain in Azure
Return to the custom domains blade in the Azure Portal.
Click Validate. Azure will query public DNS to confirm the
TXTandCNAME/Arecords match.Once all checkmarks turn green, click Add.
Step 5: Secure with a Managed SSL/TLS Certificate (HTTPS)
Azure App Service provides free managed TLS certificates for custom domains.
On your App Service menu, select Certificates under Settings (or click Add binding next to your domain in the custom domains tab).
Go to the Managed Certificates tab and click Add App Service managed certificate.
Select your custom domain (e.g.,
api.yourdomain.com).Click Create.
Once created, go back to Custom domains:
Click Add binding next to your domain.
TLS/SSL type:
SNI SSLCertificate: Select your newly generated managed certificate.
Click Add Binding.
Toggle HTTPS Only to On at the top of the Custom domains blade to automatically redirect HTTP traffic to HTTPS.
Step 6: Verification & Testing
Verify that DNS resolution and SSL termination are working:
Verify DNS Resolution:
Bash
nslookup api.yourdomain.comTest HTTPS Endpoint:
Bash
curl -I https://api.yourdomain.com

Join the conversation! Your thoughts help the community grow.