How to add a subdomain on GoDaddy on Azure site

Learn how to add a subdomain on godaddy on azure site with practical examples, diagrams, and best practices. Covers azure, dns, subdomain development techniques with visual explanations.

Seamlessly Connect Your GoDaddy Subdomain to Azure App Service

Illustration of DNS records connecting a GoDaddy domain to Azure cloud services

Learn how to configure a subdomain registered with GoDaddy to point to your Azure App Service, ensuring your web applications are accessible via custom domains.

Connecting a custom domain, especially a subdomain, to your Azure App Service is a common requirement for many web applications. This guide will walk you through the process of configuring DNS records on GoDaddy to point to your Azure App Service, ensuring your application is accessible via subdomain.yourdomain.com.

Understanding DNS Records for Subdomains

When you want to point a subdomain to an Azure App Service, you typically use a CNAME record. A CNAME (Canonical Name) record maps an alias name to a true canonical domain name. In this scenario, your subdomain (e.g., blog.yourdomain.com) will be an alias for your Azure App Service's default hostname (e.g., yourapp.azurewebsites.net).

Alternatively, if you need to point the root domain or have specific IP-based routing, A records are used. However, for subdomains pointing to Azure App Services, CNAME is the recommended and most straightforward approach.

flowchart TD
    A[User Browser] --> B["Request: subdomain.yourdomain.com"]
    B --> C[GoDaddy DNS Servers]
    C --> D["CNAME Record Lookup (subdomain.yourdomain.com -> yourapp.azurewebsites.net)"]
    D --> E[Azure DNS Servers]
    E --> F["Resolve: yourapp.azurewebsites.net to Azure App Service IP"]
    F --> G[Azure App Service]
    G --> H["Serve Content (subdomain.yourdomain.com)"]
    H --> A

Flow of a subdomain request from user to Azure App Service

Prerequisites for Configuration

Before you begin, ensure you have the following in place:

  • An active Azure App Service: Your web application should be deployed and running on an Azure App Service.
  • A custom domain registered with GoDaddy: You must own the domain (e.g., yourdomain.com) and have access to its DNS management settings on GoDaddy.
  • The desired subdomain: Decide on the subdomain you wish to use (e.g., blog, api, dev).
  • Azure App Service default hostname: You'll need the default hostname of your Azure App Service, which typically looks like yourappname.azurewebsites.net.

Step-by-Step Configuration Guide

This section outlines the detailed steps to configure your GoDaddy DNS records and your Azure App Service to work together.

1. Step 1: Add Custom Domain in Azure App Service

Navigate to your Azure App Service in the Azure portal. In the left-hand menu, under Settings, select Custom domains. Click on Add custom domain. Enter your full subdomain (e.g., blog.yourdomain.com) and click Validate. Azure will then provide you with the necessary CNAME and TXT record values you'll need to add to GoDaddy.

2. Step 2: Configure DNS Records on GoDaddy

Log in to your GoDaddy account. Go to your My Products page and select DNS next to the domain you want to configure. You will need to add two records:

  1. CNAME Record:

    • Type: CNAME
    • Name: Enter your subdomain (e.g., blog).
    • Value: Enter the default hostname of your Azure App Service (e.g., yourappname.azurewebsites.net).
    • TTL: Leave as default or set to 1 hour.
  2. TXT Record (for domain verification):

    • Type: TXT
    • Name: Enter the awverify.subdomain value provided by Azure (e.g., awverify.blog).
    • Value: Enter the awverify value provided by Azure (e.g., yourappname.azurewebsites.net).
    • TTL: Leave as default or set to 1 hour.

Save these changes in GoDaddy.

3. Step 3: Finalize Custom Domain in Azure

After adding the records on GoDaddy, return to the Azure portal. In the Add custom domain blade, click Validate again. Once the validation passes, click Add custom domain. Azure will then provision the SSL certificate (if you have one configured) and bind the subdomain to your App Service. It may take a few minutes for DNS changes to propagate globally.

4. Step 4: Test Your Subdomain

Open a web browser and navigate to your newly configured subdomain (e.g., https://blog.yourdomain.com). Your Azure App Service application should now be accessible through this custom URL.