Quickstart: Map a custom domain to Azure Spring Apps with the Standard consumption and dedicated plan

Note

The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.

This article applies to: ✅ Standard consumption and dedicated (Preview) ❎ Basic/Standard ❎ Enterprise

This article shows you how to map a custom web site domain, such as https://www.contoso.com, to your app in Azure Spring Apps. This mapping is accomplished by using a CNAME record that the Domain Name Service (DNS) uses to store node names throughout the network.

The mapping secures the custom domain with a certificate and enforces Transport Layer Security (TLS), also known as the Secure Sockets Layer (SSL).

Prerequisites

Map a custom domain

To map the custom domain, you create the CNAME record and then use the Azure CLI to bind the domain to an app in Azure Spring Apps.

First, use the following steps to create the CNAME record:

  1. Contact your DNS provider to request a CNAME record to map your domain to the Full Qualified Domain Name (FQDN) of your Spring app.

  2. Add a TXT record with the name asuid.{subdomain} with the value being the verification ID of your Azure Container Apps environment. You can obtain this value by using the following command.

    az containerapp env show \
        --resource-group <resource-group-name> \
        --name <Azure-Container-Apps-environment-name> \
        --query 'properties.customDomainConfiguration.customDomainVerificationId'
    

    After you add the CNAME and TXT record, the DNS records page will resemble the following table.

    Name Type Value
    {subdomain} CNAME testapp.agreeablewater-4c8480b3.eastus.azurecontainerapps.io
    asuid.{subdomain} A 6K861CL04CATKUCFF604024064D57PB52F5DF7B67BC3033BA9808BDA8998U270
  3. Next, bind the custom domain to your app by using the following command.

    az spring app custom-domain bind \
        --resource-group <resource-group-name> \
        --service <Azure-Spring-Apps-service-instance-name> \
        --app <app-name> \
        --domain-name <your-custom-domain-name> \
        --certificate <name-of-your-certificate-under-Azure-Container-Apps-environment>
    

Clean up resources

Be sure to delete the resources you created in this article when you no longer need them. To delete the resources, just delete the resource group that contains them. You can delete the resource group using the Azure portal. Alternatively, to delete the resource group by using Azure CLI, use the following commands:

echo "Enter the Resource Group name:" &&
read resourceGroupName &&
az group delete --name $resourceGroupName &&
echo "Press [ENTER] to continue ..."

Next steps