|
1 | 1 | ---
|
2 |
| -title: Map a custom domain to Azure Spring Apps |
| 2 | +title: Map a custom domain to Azure Spring Apps with the Standard consumption plan |
3 | 3 | description: Learn how to map a web domain to apps in Azure Spring Apps.
|
4 | 4 | author: karlerickson
|
5 | 5 | ms.author: haojianzhong
|
6 | 6 | ms.service: spring-apps
|
7 | 7 | ms.topic: quickstart
|
8 |
| -ms.date: 03/14/2023 |
| 8 | +ms.date: 03/21/2023 |
9 | 9 | ms.custom: devx-track-java
|
10 | 10 | ---
|
11 | 11 |
|
12 |
| -# Map a custom domain to Azure Spring Apps |
| 12 | +# Map a custom domain to Azure Spring Apps with the Standard consumption plan |
13 | 13 |
|
14 | 14 | **This article applies to:** ✔️ Standard consumption (Preview) ❌ Basic/Standard ❌ Enterprise
|
15 | 15 |
|
16 |
| - This article shows how to map a custom web site domain, such as such as [www.contoso.com](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. |
| 16 | + This article shows you how to map a custom web site domain, such as 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. |
17 | 17 |
|
18 | 18 | The mapping secures the custom domain with a certificate and enforces Transport Layer Security (TLS), also known as the Secure Sockets Layer (SSL).
|
19 | 19 |
|
20 | 20 | ## Prerequisites
|
21 | 21 |
|
22 |
| -* An application deployed to Azure Spring Apps. For more information see [Quickstart: Build and deploy apps to Azure Spring Apps](/azure/spring-apps/quickstart-deploy-apps). |
23 |
| -* A domain name registered in the DNS registry as provided by a web hosting or domain provider. |
24 |
| -* A certificate resource created under the Azure Container Apps Environment, see [Add certificate in Container App](/azure/container-apps/custom-domains-certificates). |
| 22 | +- An Azure subscription. If you don't have a subscription, create a [free account](https://azure.microsoft.com/free/) before you begin. |
| 23 | +- [Azure CLI](/cli/azure/install-azure-cli) |
| 24 | +- An application deployed to Azure Spring Apps. For more information, see [Quickstart: Build and deploy apps to Azure Spring Apps](/azure/spring-apps/quickstart-deploy-apps). |
| 25 | +- A domain name registered in the DNS registry as provided by a web hosting or domain provider. |
| 26 | +- A certificate resource created under an Azure Container Apps environment. For more information, see [Add certificate in Container App](../container-apps/custom-domains-certificates.md). |
25 | 27 |
|
26 | 28 | ## Map a custom domain
|
27 | 29 |
|
28 | 30 | 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.
|
29 | 31 |
|
30 |
| -### Create the CNAME record |
| 32 | +First, use the following steps to create the `CNAME` record: |
31 | 33 |
|
32 |
| -Use the following steps to create the CNAME record: |
| 34 | +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. |
33 | 35 |
|
34 |
| -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. |
35 |
| -1. 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 with the following command. |
| 36 | +1. 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. |
36 | 37 |
|
37 | 38 | ```azurecli
|
38 |
| - az containerapp env show \ |
39 |
| - --name <managed environment name> \ |
40 |
| - --resource-group <resource group> \ |
| 39 | + az containerapp env show \ |
| 40 | + --resource-group <resource-group-name> \ |
| 41 | + --name <Azure-Container-Apps-environment-name> \ |
41 | 42 | --query 'properties.customDomainConfiguration.customDomainVerificationId'
|
42 |
| - ``` |
| 43 | + ``` |
43 | 44 |
|
44 |
| -After you add the CNAME and TXT record, the DNS records page will resemble the following table. |
| 45 | +After you add the `CNAME` and `TXT` record, the DNS records page will resemble the following table. |
45 | 46 |
|
46 |
| -| Name | Type | Value | |
47 |
| -|-------------------|-------|------------------------------------------------------------------| |
48 |
| -| {subdomain} | CNAME | testapp.agreeablewater-4c8480b3.eastus.azurecontainerapps.io | |
49 |
| -| asuid.{subdomain} | A | 6K861CL04CATKUCFF604024064D57PB52F5DF7B67BC3033BA9808BDA8998U270 | |
| 47 | +| Name | Type | Value | |
| 48 | +|---------------------|---------|--------------------------------------------------------------------| |
| 49 | +| `{subdomain}` | `CNAME` | `testapp.agreeablewater-4c8480b3.eastus.azurecontainerapps.io` | |
| 50 | +| `asuid.{subdomain}` | `A` | `6K861CL04CATKUCFF604024064D57PB52F5DF7B67BC3033BA9808BDA8998U270` | |
50 | 51 |
|
51 |
| -### Bind the custom domain |
52 |
| -
|
53 |
| -Bind the custom domain to your app using the following Azure CLI command. |
| 52 | +Next, bind the custom domain to your app by using the following command. |
54 | 53 |
|
55 | 54 | ```azurecli
|
56 | 55 | az spring app custom-domain bind \
|
57 |
| - --resource-group <resource group> \ |
58 |
| - --service <service name> \ |
59 |
| - --app <app name> \ |
60 |
| - --domain-name <your custom domain name> \ |
61 |
| - --certificate <name of your certificate under managed environment> |
| 56 | + --resource-group <resource-group-name> \ |
| 57 | + --service <Azure-Spring-Apps-service-instance-name> \ |
| 58 | + --app <app-name> \ |
| 59 | + --domain-name <your-custom-domain-name> \ |
| 60 | + --certificate <name-of-your-certificate-under-Azure-Container-Apps-environment> |
| 61 | +``` |
| 62 | + |
| 63 | +## Clean up resources |
| 64 | + |
| 65 | +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. Alternately, to delete the resource group by using Azure CLI, use the following commands: |
| 66 | + |
| 67 | +```azurecli |
| 68 | +echo "Enter the Resource Group name:" && |
| 69 | +read resourceGroupName && |
| 70 | +az group delete --name $resourceGroupName && |
| 71 | +echo "Press [ENTER] to continue ..." |
62 | 72 | ```
|
63 | 73 |
|
64 | 74 | ## Next steps
|
| 75 | + |
| 76 | +- [Azure Spring Apps documentation](./index.yml) |
0 commit comments