App Service Custom Domains, Certificates and TLS
30-second answer
To map a custom domain to App Service, prove you own it and point it at the app. Create a TXT record named asuid.<subdomain> (or asuid for the root) holding the app's custom domain verification ID, plus a CNAME to <app>.azurewebsites.net for a subdomain or an A record to the app's IP for the root domain. Then add the custom domain on the app. Custom domains need Basic or higher for TLS (Free can't use them at all). Secure it with a free App Service managed certificate (no wildcards, not exportable), an imported Key Vault certificate or an uploaded .pfx, bound with SNI SSL. Finally turn on HTTPS Only and keep the minimum TLS version at 1.2 (the default) or higher.
Exam objective: 3.4.4 Configure certificates and Transport Layer Security (TLS) for an App Service. 3.4.5 Map an existing custom DNS name to an App Service. (Skills measured as of April 17, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Open the web app, then <strong>Settings → Custom domains</strong> and select <strong>+ Add custom domain</strong>. The default <code>*.azurewebsites.net</code> name already has a certificate.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Open the web app, then Settings → Custom domains and select + Add custom domain. The default .azurewebsites.net name already has a certificate.
- Choose All other domain services, the App Service Managed Certificate and SNI SSL. The portal lists the two records to create at your DNS host.
- Type dns zones in the search bar and pick DNS zones under Services.
- Add the TXT record asuid.www with the verification ID (it proves you own the domain) and the CNAME www pointing at the app. For the root domain you’d use an A record instead of a CNAME.
- Back in the pane, Validate turns green. Select Add. App Service creates the free managed certificate and binds it.
- Certificates shows it. Managed certificates are the quick, free option from Basic up.
- In Configuration → General settings, turn on HTTPS Only (HTTP gets a 301 to HTTPS) and keep Minimum Inbound TLS Version at 1.2 or higher. Save.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
Prove you own the domain
To map www.contoso-learn.com, App Service needs a TXT record asuid.www holding the app’s verification ID, plus a CNAME from www to the app (an A record for the root domain). Free tier can’t do custom domains.
🤔 What happens if…
Read this tour as text
- A registry feeds Container Instances. Azure Container Registry stores your private images. Container Instances runs them as a container group with the CPU and memory you set and a restart policy: Always, OnFailure or Never. It doesn’t scale itself, and only Premium registries can geo-replicate.
- Container Apps scale on HTTP traffic. Each replica gets an allowed CPU and memory pair (0.5 vCPU with 1 Gi here). An HTTP scale rule adds a replica per 50 concurrent requests, between min and max replicas. With min 0, a quiet app scales to zero.
- The plan is the VMs. An App Service plan is a set of VMs. Every app on the plan runs on every instance. Scale out adds instances (Basic: up to 3). Scale up moves to a bigger or richer tier, which also decides the features you get.
- Autoscale rules (Standard and up). On Standard or Premium, a rules-based autoscale setting watches a metric such as CPU Percentage and adds or removes instances between a minimum and maximum, with a cool-down so it doesn’t flap.
- Prove you own the domain. To map www.contoso-learn.com, App Service needs a TXT record asuid.www holding the app’s verification ID, plus a CNAME from www to the app (an A record for the root domain). Free tier can’t do custom domains.
- Certificate, HTTPS Only, TLS 1.2. A free App Service managed certificate (Basic and up, no wildcards, not exportable) is bound with SNI SSL. HTTPS Only redirects HTTP, and the minimum TLS version (1.2 by default) turns away old clients.
- Back up to your own storage. Automatic backups run hourly with no setup. Custom backups write files, configuration and linked databases (up to 10 GB) to a blob container you own, on demand or on a schedule with retention. Basic tier and up.
- Outbound and inbound are different switches. VNet integration is outbound: the app reaches private resources through a delegated subnet. Inbound is controlled by access restrictions (allow and deny rules by priority) or a private endpoint.
- Staging slot, warm-up, swap. A deployment slot (Standard: 5, Premium v3: 20) is a live copy of the app. Deploy to staging, then swap: App Service warms staging up first, so users never hit a cold start. Slot settings stay with their slot.
The shop should answer on www.contoso-learn.com over HTTPS only. Prove you own the domain with DNS records, add a free managed certificate, bind it, and refuse old TLS versions.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
Customers see app-contoso-www01.azurewebsites.net and a browser warning on your own name.
😊 THE SOLUTION
Verify the domain with DNS, bind a certificate, and force HTTPS with TLS 1.2.
- Ugly default URL✓ CNAME + asuid TXT
- Certificate warning✓ Managed certificate, SNI binding
- Plain HTTP and old TLS✓ HTTPS Only, minimum TLS 1.2
Start with a question
How does a post office know it's really your new address?
When you move house, you can’t just tell the post office “send Ravi’s letters to me”. They want proof: a bill or a letter with your name at the new address. Then they forward the mail, and you put a lock on the letterbox so nobody reads it on the way.
A custom domain works the same way. A TXT record in DNS is your proof of address. A CNAME (or A record) forwards visitors to the app. The TLS certificate is the lock, and HTTPS Only makes sure nothing arrives in an open envelope.
Explain it like I’m 10
The technical explanation
Map an existing custom DNS name
You need three things: a plan on Basic or higher (Free doesn’t support custom domains, and Shared can’t bind certificates), access to the domain’s DNS, and the app’s custom domain verification ID.
Portal: web app → Settings → Custom domains → + Add custom domain. Choose All other domain services (or App Service Domain if you bought it in Azure), the certificate option and SNI SSL, type the domain, and the pane lists the records to create:
| Domain | Records to create at your DNS host |
|---|---|
Subdomain (www.contoso-learn.com) | TXT asuid.www = verification ID, CNAME www → app-contoso-www01.azurewebsites.net |
| Root (contoso-learn.com) | TXT asuid = verification ID, A @ → the app’s inbound IP address |
| Wildcard (*.contoso-learn.com) | TXT asuid = verification ID, CNAME * → the app’s default domain |
Select Validate, then Add. If the domain already serves live traffic elsewhere, add the TXT record first and switch the CNAME last, so the move has no downtime.
az webapp show -g rg-admin-dns -n app-contoso-www01 --query customDomainVerificationId -o tsv
az network dns record-set txt add-record -g rg-admin-dns -z contoso-learn.com -n asuid.www -v <verification-id>
az network dns record-set cname set-record -g rg-admin-dns -z contoso-learn.com -n www -c app-contoso-www01.azurewebsites.net
az webapp config hostname add -g rg-admin-dns --webapp-name app-contoso-www01 --hostname www.contoso-learn.com
Set-AzWebApp -ResourceGroupName rg-admin-dns -Name app-contoso-www01 -HostNames @('www.contoso-learn.com', 'app-contoso-www01.azurewebsites.net')
Certificates: four ways to get one
| Option | Cost | Wildcard | Export | Notes |
|---|---|---|---|---|
| App Service managed certificate | Free | No | No | Basic and up; renews itself; the app must be publicly reachable |
| App Service certificate | Paid yearly | Yes | Yes | Bought in Azure, stored in Key Vault |
| Import from Key Vault | Your certificate | Yes | Yes | The app needs access to the vault; renewals sync |
| Upload a .pfx | Your certificate | Yes | You hold it | Password-protected, private key exportable |
You’ll find them in Settings → Certificates: Managed certificates, Bring your own certificates (.pfx) and Public key certificates (.cer), the last one for outbound calls, not for your domain.
Binding connects a certificate to a hostname. SNI SSL is the normal choice; IP SSL gives the hostname its own IP address and is for old clients that don’t send SNI.
az webapp config ssl create -g rg-admin-dns -n app-contoso-www01 --hostname www.contoso-learn.com
az webapp config ssl bind -g rg-admin-dns -n app-contoso-www01 \
--certificate-thumbprint <thumbprint> --ssl-type SNI
PowerShell uses New-AzWebAppCertificate for a managed certificate and New-AzWebAppSSLBinding to bind one.
Configure TLS
In Settings → Configuration → General settings (the platform settings):
- HTTPS Only: On sends a 301 from
http://tohttps://. - Minimum Inbound TLS Version: 1.2 by default. Choose 1.3 for the strictest setting; 1.0 and 1.1 are only for very old clients.
- FTP state: FTPS only or Disabled, so nothing uploads in clear text.
az webapp update -g rg-admin-dns -n app-contoso-www01 --https-only true
az webapp config set -g rg-admin-dns -n app-contoso-www01 --min-tls-version 1.2
Architect level What a swap does to domains and certificates
Custom domain names, non-public certificates and TLS settings stay with their deployment slot when you swap. That’s on purpose: production keeps www.contoso-learn.com and its certificate, and only the code and swappable settings move. If you want staging on its own domain, add a separate hostname (such as staging.contoso-learn.com) to the staging slot.
Real-world business scenario
Contoso Learning (fictional)
- The problem
- The course site lived at app-contoso-www01.azurewebsites.net. Marketing printed www.contoso-learn.com on flyers, and the security review flagged TLS 1.0 and plain HTTP.
- What they used
- The plan was moved from Free to Basic B1. The team added the asuid.www TXT record and a www CNAME in Azure DNS, an A record and asuid TXT for the root domain, App Service managed certificates for both names with SNI SSL, HTTPS Only, and minimum TLS 1.2.
- Why that choice
- Basic is the cheapest tier with TLS bindings, managed certificates cost nothing and renew themselves, and the DNS records prove ownership without touching the live site until the end.
- The result
- Both names serve over HTTPS with a padlock, HTTP redirects, the audit closed, and nobody has to remember a renewal date.
When to use it and when not to
✓ Use it when…
- A public web app should answer on your own domain name.
- You want a free certificate that renews itself for www or the root domain.
- Compliance asks for HTTPS everywhere and modern TLS only.
✕ Think twice when…
- You need *.contoso.com covered by one free certificate. Managed certificates don't do wildcards.
- The certificate must be reused on other servers. Use Key Vault or an App Service certificate.
- The app runs on the Free tier. Scale up first.
↔ Alternatives to consider
- Azure Front Door to terminate TLS at the edge for several apps and regions.
- Azure Key Vault certificates when one certificate is shared across services.
- App Service Domain to buy the domain in Azure, with DNS set up for you.
Test yourself with exercises
5 original practice questions in the AZ-104 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner Why does App Service ask for a TXT record before it accepts my domain?
Model answer
To stop anyone else from claiming it. Only the owner of the domain can add a TXT record named asuid.www with the app's verification ID, so the record proves the domain is mine before App Service starts serving it.
Intermediate How do you map the root domain contoso.com rather than www?
Model answer
DNS doesn't allow a CNAME at the zone apex, so I'd create an A record at @ pointing to the app's inbound IP address, plus a TXT record named asuid with the verification ID. Then I add contoso.com as a custom domain on the app.
Experienced developer When wouldn't you use an App Service managed certificate?
Model answer
When I need a wildcard like *.contoso.com, when I need to export the certificate to use somewhere else, or when the security team wants a specific certificate authority or an EV certificate. Then I'd import a certificate from Key Vault, buy an App Service certificate, or upload a password-protected .pfx. Managed certificates also need the app to be reachable publicly so the issuer can validate it.
Scenario An audit says the site still accepts TLS 1.0 and plain HTTP. What do you change?
Model answer
In Configuration, General settings, I'd set HTTPS Only to On so HTTP gets redirected, and set Minimum Inbound TLS Version to 1.2 or 1.3. In the CLI that's az webapp update --https-only true and az webapp config set --min-tls-version 1.2. Neither change needs a redeploy.
Quick revision
Key points
- Ownership is proven with a TXT record asuid.<subdomain> containing the custom domain verification ID.
- Subdomains use a CNAME to <app>.azurewebsites.net; the root domain uses an A record to the app's IP.
- Free tier has no custom domains; Shared can map a domain but can't bind a certificate; Basic and up can do both.
- Managed certificates are free and auto-renewed, but can't be wildcards or exported.
- HTTPS Only redirects HTTP; minimum inbound TLS version defaults to 1.2.
Important terminology
- Custom domain verification ID
- A value unique to the app (and subscription) that you put in an asuid TXT record to prove you control the domain.
- asuid TXT record
- The DNS TXT record App Service checks for domain ownership, named asuid.<subdomain>, or asuid for the root domain.
- CNAME record
- A DNS alias from one name to another, such as www to app-contoso.azurewebsites.net. Used for subdomains, not the root.
- App Service managed certificate
- A free TLS certificate App Service issues and renews for a custom domain. No wildcards and it can't be exported.
- SNI SSL
- A TLS binding that uses Server Name Indication, so many certificates share one IP address. The usual choice.
- HTTPS Only
- A setting that redirects every HTTP request to HTTPS with a 301.
- Minimum inbound TLS version
- The oldest TLS version clients may use to connect. Default 1.2; 1.0, 1.1 and 1.3 are the other options.
Common mistakes
- Trying to create a CNAME at the zone apex.
- Requesting a managed certificate before the custom domain is added to the app.
- Expecting a managed certificate to cover *.contoso.com.
Exam tips
- "Verify domain ownership" = TXT record asuid.<name>.
- "Free certificate that renews itself" = App Service managed certificate (Basic or higher).
- "Wildcard certificate" = import from Key Vault, buy an App Service certificate, or upload a .pfx.
Five quick revision questions
-
1.Which record proves domain ownership to App Service?Show
A TXT record named asuid.<subdomain>.
-
2.Which record maps www to the app?Show
A CNAME to <app>.azurewebsites.net.
-
3.Can a managed certificate be a wildcard?Show
No.
-
4.What is the default minimum inbound TLS version?Show
1.2.
-
5.Which binding type lets many certificates share one IP?Show
SNI SSL.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: App Service Backup and Networking
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.