แก้ไข

แชร์ผ่าน


Quickstart: Access applications using Azure Spring Apps Standard consumption and dedicated plan in a virtual network

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 describes how to access your application in a virtual network using Azure Spring Apps Standard consumption and dedicated plan.

When you create an Azure Container Apps environment in an existing virtual network, you can access all the apps inside the environment only within that virtual network. In addition, when you create an instance of Azure Spring Apps inside the Azure Container Apps environment, you can access the applications in the Azure Spring Apps instance only from the virtual network. For more information, see Provide a virtual network to an internal Azure Container Apps environments.

Create a private DNS zone

Create a private DNS zone named as the default domain of the Azure Container Apps environment - <UNIQUE_IDENTIFIER>.<REGION_NAME>.azurecontainerapps.io - with an A record.

Use the following command to get the default domain of Azure Container Apps environment.

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

Use the following command to create a Private DNS Zone for applications in the virtual network.

az network private-dns zone create \
    --resource-group <resource-group-name> \
    --name <private-dns-zone-name>

Create an A record

Create an A record that contains the name <DNS Suffix> and the static IP address of the Azure Container Apps environment.

Use the following command to get the static IP address for an Azure Container Apps environment.

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

Use the following command to create the A record:

az network private-dns record-set a add-record \
    --resource-group <resource-group-name> \
    --zone-name <private-dns-zone-name> \
    --record-set-name '*' \
    --ipv4-address <static-ip>

Use the following command to create a virtual network link to the private DNS zone of the virtual network.

az network private-dns link vnet create \
    --resource-group <resource-group-name> \
    --name <link-name> \
    --zone-name <private-dns-zone-name> \
    --virtual-network <virtual-network-name> \
    --registration-enabled false

Access the application

Now you can access an application in an Azure Spring Apps instance within your virtual network, using the URL of the application.

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