Step-by-Step Demo – Configure Custom Domain name for your Azure App Service


To configure a custom domain name for your Azure App Service, you'll need to follow a series of steps.

This involves adding the domain to your App Service, verifying ownership through DNS, and ensuring your app is accessible via that domain.

Here’s a step-by-step guide.

Step 1: Prepare Your Domain

Before you can configure a custom domain, ensure you have:

  1. A registered domain name (e.g., www.yourdomain.com) from a domain registrar.

  2. Access to your domain registrar’s DNS management interface to add DNS records.

Step 2: Access the Azure Portal

  1. Go to the Azure Portal.

  2. In the left-hand menu, select "App Services".

  3. Select the app (web app) to which you want to add the custom domain.

Step 3: Add a Custom Domain to Your App Service

  1. In the App Service dashboard, under the Settings section, click on "Custom domains".

  2. Click the "Add custom domain" button.

  3. Enter the domain name you want to use (e.g., www.yourdomain.com) and click "Validate".

Step 4: Verify Domain Ownership via DNS

To verify that you own the domain, you need to add a DNS record at your domain registrar’s DNS management interface.

  1. Choose a verification method:

    • CNAME Verification (Recommended for subdomains like www.yourdomain.com): You’ll be instructed to add a CNAME record pointing from your domain to your app’s default domain (e.g., yourapp.azurewebsites.net).

    • TXT Verification (Recommended for root domains): You'll be provided with a TXT record to add to your domain’s DNS settings for verification.

  2. Login to your domain registrar:

    • Go to your domain registrar’s website (e.g., GoDaddy, Namecheap, Google Domains, etc.).

    • Find the DNS management section.

  3. Add the necessary DNS record:

    • For CNAME: Add a CNAME record with the following details:

      • Name: The subdomain you want to point to your app (e.g., www for www.yourdomain.com).

      • Value: Your app’s default domain, which is typically in the form yourapp.azurewebsites.net.

      • For TXT: Add the TXT record provided by Azure to the DNS settings to verify your domain ownership.

    • Wait for DNS Propagation:

      • DNS changes can take up to 48 hours to propagate, though it often happens much sooner.

      • You can use tools like to monitor the propagation.

Step 5: Complete the Domain Configuration in Azure

Once your DNS changes have propagated and Azure successfully validates the DNS records, complete the domain addition:

  • After the verification is successful, return to the Azure Portal.

  • Under Custom domains, click "Add domain".

  • Azure will now map your custom domain to the App Service, and you should see your domain listed under Custom domains.

Step 6: Configure SSL for Secure Access (HTTPS)

To ensure your custom domain is secure, it’s highly recommended to configure SSL (Secure Sockets Layer) for HTTPS.

  1. Go to TLS/SSL settings:

    • In the App Service settings, click "TLS/SSL settings" under Settings.

  2. Create or Upload an SSL certificate:

    • Managed Certificate: If you want a free SSL certificate from Azure, click "Create App Service Managed Certificate". This certificate will automatically renew and is sufficient for most domains.

    • Custom Certificate: If you already have an SSL certificate (e.g., from a third-party provider), click "Upload Certificate" and upload your certificate (.pfx file).

  3. Bind SSL to your domain:

    • Go to TLS/SSL bindings.

    • Click "Add TLS/SSL Binding".

    • Select your custom domain and the SSL certificate.

    • Click "Add Binding" to complete the process.

  4. Enforce HTTPS (Optional but recommended):

    • In the TLS/SSL settings, toggle the "HTTPS Only" setting to "On" to force all traffic to your site to use HTTPS, ensuring secure connections.

Step 7: Test the Custom Domain

After completing these steps, go to your browser and test your custom domain (e.g., https://www.yourdomain.com).

Ensure that:

  • The domain resolves to your Azure App Service.

  • The website is accessible and loads securely over HTTPS.

Troubleshooting Tips

  1. DNS Propagation Delay: DNS updates can take time (up to 48 hours). If you don’t see your site immediately, wait a few hours and try again.

  2. SSL Certificate Issues: If you see certificate errors, double-check the certificate binding and ensure that you’ve uploaded the correct certificate for the custom domain.

  3. Redirection Issues: If your app doesn’t redirect from HTTP to HTTPS automatically, make sure the "HTTPS Only" option is enabled in the TLS/SSL settings.

Optional: Redirect the Root Domain to the "www" Subdomain (If Needed)

If you want to redirect users from yourdomain.com (root domain) to www.yourdomain.com, you can do this by setting up a URL Rewrite rule within your App Service:

  1. Go to your App Service in the Azure Portal.

  2. Under Settings, click "Configuration".

  3. Set up a rewrite rule to redirect all traffic from the root domain (yourdomain.com) to www.yourdomain.com.

Alternatively, you can configure this at the DNS level by setting up a URL redirect record, but the URL rewrite approach allows you to control this at the app level.

Summary

By following these steps, you'll successfully configure a custom domain name for your Azure App Service web app.

This will make your app accessible under a professional, branded domain, and securing it with SSL will ensure the site is safe and trusted by visitors.

 

Related Articles


Rajnish, MCT

Leave a Reply

Your email address will not be published. Required fields are marked *


SUBSCRIBE

My newsletter for exclusive content and offers. Type email and hit Enter.

No spam ever. Unsubscribe anytime.
Read the Privacy Policy.