Skip to content

Commit f58b29b

Browse files
committed
reorder
1 parent cce59da commit f58b29b

File tree

2 files changed

+276
-3
lines changed

2 files changed

+276
-3
lines changed

articles/container-apps/networking.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ You can fully secure your ingress and egress networking traffic workload profile
282282

283283
Azure Container Apps supports peer-to-peer TLS encryption within the environment. Enabling this feature encrypts all network traffic within the environment with a private certificate that is valid within the Azure Container Apps environment scope. These certificates are automatically managed by Azure Container Apps.
284284

285+
> [!NOTE]
286+
> By default, peer-to-peer encryption is disabled. Enabling peer-to-peer encryption for your applications may increase response latency and reduce maximum throughput in high-load scenarios.
287+
285288
The following example shows an environment with peer-to-peer encryption enabled.
286289
:::image type="content" source="media/networking/peer-to-peer-encryption-traffic-diagram.png" alt-text="Diagram of how traffic is encrypted/decrypted with peer-to-peer encryption enabled.":::
287290

@@ -297,9 +300,6 @@ Applications within a Container Apps environment are automatically authenticated
297300

298301
When your apps are communicating with a client outside of the environment, two-way authentication with mTLS is supported. To learn more, see [configure client certificates](client-certificate-authorization.md).
299302

300-
> [!NOTE]
301-
> By default, peer-to-peer encryption is disabled. Enabling peer-to-peer encryption for your applications may increase response latency and reduce maximum throughput in high-load scenarios.
302-
303303
# [Azure CLI](#tab/azure-cli)
304304

305305
You can enable peer-to-peer encryption using the following commands.
Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
---
2+
title: Configure Azure Container Apps with Private Endpoints
3+
description: Learn how to protect Azure Container Apps with Private Endpoints
4+
services: container-apps
5+
author: cachai2
6+
ms.service: container-apps
7+
ms.topic: how-to
8+
ms.date: 06/11/2024
9+
ms.author: cachai
10+
---
11+
12+
# Protect Azure Container Apps with Web Application Firewall on Application Gateway
13+
14+
## Prerequisites
15+
16+
- **Internal environment with custom VNet**: Have a container app that is on an internal environment and integrated with a custom virtual network. For more information on how to create a custom virtual network integrated app, see [provide a virtual network to an internal Azure Container Apps environment](./vnet-custom-internal.md).
17+
18+
- **Security certificates**: If you must use TLS/SSL encryption to the application gateway, a valid public certificate that's used to bind to your application gateway is required.
19+
20+
## Retrieve your container app's domain
21+
22+
## Create and configure an Azure Private DNS zone
23+
24+
25+
26+
# Create a private endpoint for Azure Container Apps
27+
28+
Get started with Azure Private Link by creating and using a private endpoint to connect securely to an Azure web app.
29+
30+
In this quickstart, create a private endpoint for an Azure App Services web app and then create and deploy a virtual machine (VM) to test the private connection.
31+
32+
You can create private endpoints for various Azure services, such as Azure SQL and Azure Storage.
33+
34+
:::image type="content" source="./media/create-private-endpoint-portal/private-endpoint-qs-resources.png" alt-text="Diagram of resources created in private endpoint quickstart." lightbox="./media/create-private-endpoint-portal/private-endpoint-qs-resources.png":::
35+
36+
## Prerequisites
37+
38+
* An Azure account with an active subscription. If you don't already have an Azure account, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
39+
40+
* An Azure Container App environment with a *Dedicated workload profile*, deployed in your Azure subscription. Having the container app environment be integrated with a virtual network is optional.
41+
42+
- For more information and an example, see [Quickstart: Create an ASP.NET Core web app in Azure](../app-service/quickstart-dotnetcore.md).
43+
44+
- The example webapp in this article is named **webapp-1**. Replace the example with your webapp name.
45+
46+
[!INCLUDE [azure-cli-prepare-your-environment.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment-no-header.md)]
47+
48+
## Create a resource group
49+
50+
An Azure resource group is a logical container where Azure resources are deployed and managed.
51+
52+
First, create a resource group by using **[az group create](/cli/azure/group#az-group-create)**:
53+
54+
```azurecli-interactive
55+
az group create \
56+
--name test-rg \
57+
--location eastus2
58+
```
59+
60+
## Create a virtual network and bastion host
61+
62+
A virtual network and subnet is required for to host the private IP address for the private endpoint. You create a bastion host to connect securely to the virtual machine to test the private endpoint. You create the virtual machine in a later section.
63+
64+
>[!NOTE]
65+
>[!INCLUDE [Pricing](../../includes/bastion-pricing.md)]
66+
67+
Create a virtual network with **[az network vnet create](/cli/azure/network/vnet#az-network-vnet-create)**.
68+
69+
```azurecli-interactive
70+
az network vnet create \
71+
--resource-group test-rg \
72+
--location eastus2 \
73+
--name vnet-1 \
74+
--address-prefixes 10.0.0.0/16 \
75+
--subnet-name subnet-1 \
76+
--subnet-prefixes 10.0.0.0/24
77+
```
78+
79+
Create a bastion subnet with **[az network vnet subnet create](/cli/azure/network/vnet/subnet#az-network-vnet-subnet-create)**.
80+
81+
```azurecli-interactive
82+
az network vnet subnet create \
83+
--resource-group test-rg \
84+
--name AzureBastionSubnet \
85+
--vnet-name vnet-1 \
86+
--address-prefixes 10.0.1.0/26
87+
```
88+
89+
Create a public IP address for the bastion host with **[az network public-ip create](/cli/azure/network/public-ip#az-network-public-ip-create)**.
90+
91+
```azurecli-interactive
92+
az network public-ip create \
93+
--resource-group test-rg \
94+
--name public-ip \
95+
--sku Standard \
96+
--zone 1 2 3
97+
```
98+
99+
Create the bastion host with **[az network bastion create](/cli/azure/network/bastion#az-network-bastion-create)**.
100+
101+
```azurecli-interactive
102+
az network bastion create \
103+
--resource-group test-rg \
104+
--name bastion \
105+
--public-ip-address public-ip \
106+
--vnet-name vnet-1 \
107+
--location eastus2
108+
```
109+
110+
It can take a few minutes for the Azure Bastion host to deploy.
111+
112+
## Create a private endpoint
113+
114+
An Azure service that supports private endpoints is required to set up the private endpoint and connection to the virtual network. For the examples in this article, use the Azure WebApp from the prerequisites. For more information on the Azure services that support a private endpoint, see [Azure Private Link availability](availability.md).
115+
116+
A private endpoint can have a static or dynamically assigned IP address.
117+
118+
> [!IMPORTANT]
119+
> You must have a previously deployed Azure App Services WebApp to proceed with the steps in this article. For more information, see [Prerequisites](#prerequisites) .
120+
121+
Place the resource ID of the web app that you created earlier into a shell variable with **[az webapp list](/cli/azure/webapp#az-webapp-list)**. Create the private endpoint with **[az network private-endpoint create](/cli/azure/network/private-endpoint#az-network-private-endpoint-create)**.
122+
123+
# [**Dynamic IP**](#tab/dynamic-ip)
124+
125+
```azurecli-interactive
126+
id=$(az webapp list \
127+
--resource-group test-rg \
128+
--query '[].[id]' \
129+
--output tsv)
130+
131+
az network private-endpoint create \
132+
--connection-name connection-1 \
133+
--name private-endpoint \
134+
--private-connection-resource-id $id \
135+
--resource-group test-rg \
136+
--subnet subnet-1 \
137+
--group-id sites \
138+
--vnet-name vnet-1
139+
```
140+
141+
# [**Static IP**](#tab/static-ip)
142+
143+
```azurecli-interactive
144+
id=$(az webapp list \
145+
--resource-group test-rg \
146+
--query '[].[id]' \
147+
--output tsv)
148+
149+
az network private-endpoint create \
150+
--connection-name connection-1 \
151+
--name private-endpoint \
152+
--private-connection-resource-id $id \
153+
--resource-group test-rg \
154+
--subnet subnet-1 \
155+
--group-id sites \
156+
--ip-config name=ipconfig-1 group-id=sites member-name=sites private-ip-address=10.0.0.10 \
157+
--vnet-name vnet-1
158+
```
159+
160+
---
161+
162+
## Configure the private DNS zone
163+
164+
A private DNS zone is used to resolve the DNS name of the private endpoint in the virtual network. For this example, we're using the DNS information for an Azure WebApp, for more information on the DNS configuration of private endpoints, see [Azure Private Endpoint DNS configuration](private-endpoint-dns.md)].
165+
166+
Create a new private Azure DNS zone with **[az network private-dns zone create](/cli/azure/network/private-dns/zone#az-network-private-dns-zone-create)**.
167+
168+
```azurecli-interactive
169+
az network private-dns zone create \
170+
--resource-group test-rg \
171+
--name "privatelink.azurewebsites.net"
172+
```
173+
174+
Link the DNS zone to the virtual network you created previously with **[az network private-dns link vnet create](/cli/azure/network/private-dns/link/vnet#az-network-private-dns-link-vnet-create)**.
175+
176+
```azurecli-interactive
177+
az network private-dns link vnet create \
178+
--resource-group test-rg \
179+
--zone-name "privatelink.azurewebsites.net" \
180+
--name dns-link \
181+
--virtual-network vnet-1 \
182+
--registration-enabled false
183+
```
184+
185+
Create a DNS zone group with **[az network private-endpoint dns-zone-group create](/cli/azure/network/private-endpoint/dns-zone-group#az-network-private-endpoint-dns-zone-group-create)**.
186+
187+
```azurecli-interactive
188+
az network private-endpoint dns-zone-group create \
189+
--resource-group test-rg \
190+
--endpoint-name private-endpoint \
191+
--name zone-group \
192+
--private-dns-zone "privatelink.azurewebsites.net" \
193+
--zone-name webapp
194+
```
195+
196+
## Create a test virtual machine
197+
198+
To verify the static IP address and the functionality of the private endpoint, a test virtual machine connected to your virtual network is required.
199+
200+
Create the virtual machine with **[az vm create](/cli/azure/vm#az-vm-create)**.
201+
202+
```azurecli-interactive
203+
az vm create \
204+
--resource-group test-rg \
205+
--name vm-1 \
206+
--image Win2022Datacenter \
207+
--public-ip-address "" \
208+
--vnet-name vnet-1 \
209+
--subnet subnet-1 \
210+
--admin-username azureuser
211+
```
212+
213+
>[!NOTE]
214+
>Virtual machines in a virtual network with a bastion host don't need public IP addresses. Bastion provides the public IP, and the VMs use private IPs to communicate within the network. You can remove the public IPs from any VMs in bastion hosted virtual networks. For more information, see [Dissociate a public IP address from an Azure VM](../virtual-network/ip-services/remove-public-ip-address-vm.md).
215+
216+
[!INCLUDE [ephemeral-ip-note.md](../../includes/ephemeral-ip-note.md)]
217+
218+
## Test connectivity to the private endpoint
219+
220+
Use the virtual machine that you created earlier to connect to the web app across the private endpoint.
221+
222+
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines**.
223+
224+
1. Select **vm-1**.
225+
226+
1. On the overview page for **vm-1**, select **Connect**, and then select the **Bastion** tab.
227+
228+
1. Select **Use Bastion**.
229+
230+
1. Enter the username and password that you used when you created the VM.
231+
232+
1. Select **Connect**.
233+
234+
1. After you've connected, open PowerShell on the server.
235+
236+
1. Enter `nslookup webapp-1.azurewebsites.net`. You receive a message that's similar to the following example:
237+
238+
```output
239+
Server: UnKnown
240+
Address: 168.63.129.16
241+
242+
Non-authoritative answer:
243+
Name: webapp-1.privatelink.azurewebsites.net
244+
Address: 10.0.0.10
245+
Aliases: webapp-1.azurewebsites.net
246+
```
247+
248+
A private IP address of **10.0.0.10** is returned for the web app name if you chose static IP address in the previous steps. This address is in the subnet of the virtual network you created earlier.
249+
250+
1. In the bastion connection to **vm-1**, open the web browser.
251+
252+
1. Enter the URL of your web app, `https://webapp-1.azurewebsites.net`.
253+
254+
If your web app hasn't been deployed, you get the following default web app page:
255+
256+
:::image type="content" source="./media/create-private-endpoint-portal/web-app-default-page.png" alt-text="Screenshot of the default web app page on a browser." border="true":::
257+
258+
1. Close the connection to **vm-1**.
259+
260+
## Clean up resources
261+
262+
When no longer needed, use the [az group delete](/cli/azure/group#az-group-delete) command to remove the resource group, private link service, load balancer, and all related resources.
263+
264+
```azurecli-interactive
265+
az group delete \
266+
--name test-rg
267+
```
268+
269+
## Next steps
270+
271+
For more information about the services that support private endpoints, see:
272+
> [!div class="nextstepaction"]
273+
> [What is Azure Private Link?](private-link-overview.md#availability)

0 commit comments

Comments
 (0)