Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 29 of 47
❮Prev Next❯

App Service Custom Domains, Certificates and TLS

Module 3: Compute ⏱ 11 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    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.

    Simulate it » No Azure account needed

    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.

    Azure portal: Map a custom domain, add a managed certificate and enforce TLS Map www, add a managed certificate and enforce TLS 1.2.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    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
    1. Open the web app, then Settings → Custom domains and select + Add custom domain. The default .azurewebsites.net name already has a certificate.
    2. 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.
    3. Type dns zones in the search bar and pick DNS zones under Services.
    4. 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.
    5. Back in the pane, Validate turns green. Select Add. App Service creates the free managed certificate and binds it.
    6. Certificates shows it. Managed certificates are the quick, free option from Basic up.
    7. 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.

    😟 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
    🛠️ Solved with: Custom domains and TLS

    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:

    DomainRecords 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

    OptionCostWildcardExportNotes
    App Service managed certificateFreeNoNoBasic and up; renews itself; the app must be publicly reachable
    App Service certificatePaid yearlyYesYesBought in Azure, stored in Key Vault
    Import from Key VaultYour certificateYesYesThe app needs access to the vault; renewals sync
    Upload a .pfxYour certificateYesYou hold itPassword-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:// to https://.
    • 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

    Education

    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.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    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.

    Question 1

    Question 1 of 5

    You plan to map www.contoso.com to a web app named app-contoso. The DNS zone for contoso.com is hosted by a third-party DNS provider.

    Which record must you create to verify ownership of the domain?

    Question 2

    Question 2 of 5

    You need to map the root domain contoso.com to a web app. Which DNS records should you create?

    Question 3

    Question 3 of 5

    A web app has the custom domains www.contoso.com and shop.contoso.com. You need a TLS certificate for each name. The solution must minimize cost and administrative effort for renewals.

    What should you use?

    Question 4

    Question 4 of 5

    A security audit requires that a web app reject connections that use TLS 1.0 or TLS 1.1 and redirect HTTP requests to HTTPS. Which two settings should you configure?

    Question 5

    Question 5 of 5

    A web app runs on an App Service plan in the Free F1 tier. You need to add the custom domain www.contoso.com and secure it with TLS. What should you do first?

    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. 1.Which record proves domain ownership to App Service?Show

      A TXT record named asuid.<subdomain>.

    2. 2.Which record maps www to the app?Show

      A CNAME to <app>.azurewebsites.net.

    3. 3.Can a managed certificate be a wildcard?Show

      No.

    4. 4.What is the default minimum inbound TLS version?Show

      1.2.

    5. 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

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.