You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Create a private link to an Azure Container App with Azure Front Door (preview)
14
15
15
16
In this article, you learn how to connect directly from Azure Front Door to your Azure Container Apps using a private link instead of the public internet. In this tutorial, you create an Azure Container Apps workload profiles environment, an Azure Front Door, and connect them securely through a private link. You then verify the connectivity between your container app and the Azure Front Door.
16
17
18
+
::: zone pivot="azure-portal"
19
+
20
+
## Prerequisites
21
+
22
+
- Azure account with an active subscription.
23
+
- If you don't have one, you [can create one for free](https://azure.microsoft.com/free/).
24
+
25
+
- This feature is only supported for workload profile environments.
26
+
27
+
- Make sure the `Microsoft.Cdn` resource provider is registered for your subscription.
28
+
1. Begin by signing in to the [Azure portal](https://portal.azure.com).
29
+
1. Browse to your subscription page and select **Settings** > **Resource providers**.
30
+
1. Select **Microsoft.Cdn** from the provider list.
31
+
1. Select **Register**.
32
+
33
+
## Create a container app
34
+
35
+
Create a resource group to organize the services related to your container app deployment.
36
+
37
+
1. Search for **Container Apps** in the top search bar.
38
+
1. Select **Container Apps** in the search results.
39
+
1. Select the **Create** button.
40
+
41
+
1. In the *Create Container App* page, in the *Basics* tab, do the following actions.
42
+
43
+
| Setting | Action |
44
+
|---|---|
45
+
| Subscription | Select your Azure subscription. |
46
+
| Resource group | Select the **Create new resource group** link and enter **my-container-apps**. |
47
+
| Container app name | Enter **my-container-app**. |
3. When you browse to the container app endpoint, you see the following message:
78
+
79
+
```
80
+
The public network access on this managed environment is disabled. To connect to this managed environment, please use the Private Endpoint from inside your virtual network. To learn more https://aka.ms/PrivateEndpointTroubleshooting.
81
+
```
82
+
83
+
Instead, you use an Azure Front Door endpoint to access your container app.
84
+
85
+
## Create an Azure Front Door profile and endpoint
86
+
87
+
1. Search for **Front Door** in the top search bar.
88
+
1. Select **Front Door and CDN profiles** in the search results.
89
+
1. Select **Azure Front Door** and **Quick Create**.
90
+
1. Select the **Continue to create a Front Door** button.
91
+
92
+
1. In the *Create a Front Door profile* page, in the *Basics* tab, do the following actions.
93
+
94
+
| Setting | Actions |
95
+
|--|--|
96
+
| Resource group | Select **my-container-apps**. |
97
+
| Name | Enter **my-afd-profile**. |
98
+
| Tier | Select **Premium**. Private link isn't supported for origins for Azure Front Door on the Standard tier. |
99
+
| Endpoint name | Enter **my-afd-endpoint**. |
100
+
| Origin type | Select **Container Apps**. |
101
+
| Origin host name | Enter the hostname of your container app. Your hostname looks like the following example: `my-container-app.orangeplant-77e5875b.centralus.azurecontainerapps.io`. |
102
+
| Enable private link service | Enable this setting. |
103
+
| Region | Select **(US) Central US**. |
104
+
| Target sub resource | Select **managedEnvironments**. |
105
+
| Request message | Enter **AFD Private Link Request**. |
106
+
107
+
1. Select **Review + create**.
108
+
109
+
1. Select **Create**.
110
+
111
+
1. After the deployment completes, select **Go to resource**.
112
+
113
+
1. In the *Front Door and CDN profile* overview page, find your *Endpoint hostname*. It looks like the following example. Make a note of this hostname.
114
+
115
+
```
116
+
my-afd-endpoint.<HASH>.b01.azurefd.net
117
+
```
118
+
119
+
## Approve the private endpoint connection request
120
+
121
+
1. Browse to the overview page for the environment named *my-environment* you created previously.
122
+
123
+
1. Expand **Settings** > **Networking**.
124
+
125
+
1. You see a link for the private endpoint connection requests. For example, `1 private endpoint`. Select this link.
126
+
127
+
1. In the *Private endpoint connections* page, approve each private endpoint connection request with the description `AFD Private Link Request`.
128
+
129
+
> [!NOTE]
130
+
> Azure Front Door has a known issue where it might create multiple private endpoint connection requests.
131
+
132
+
## Access your container app from Azure Front Door
133
+
134
+
Browse to the Azure Front Door endpoint hostname you recorded previously. You see the output for the quickstart container app image. Global deployment could take a few minutes to deploy, so if you don't see the expected output, wait a few minutes and then refresh.
135
+
136
+
## Clean up resources
137
+
138
+
If you're not going to continue to use this application, you can delete the container app and all the associated services by removing the resource group.
139
+
140
+
1. Select the **my-container-apps** resource group from the *Overview* section.
141
+
1. Select the **Delete resource group** button at the top of the resource group *Overview*.
142
+
1. Enter the resource group name **my-container-apps** in the *Are you sure you want to delete "my-container-apps"* confirmation dialog.
143
+
1. Select **Delete**.
144
+
145
+
The process to delete the resource group could take a few minutes to complete.
146
+
147
+
::: zone-end
148
+
149
+
::: zone pivot="azure-cli"
150
+
17
151
## Prerequisites
18
152
19
153
- Azure account with an active subscription.
20
154
- If you don't have one, you [can create one for free](https://azure.microsoft.com/free/).
21
155
22
-
-This feature is only available with the [Azure CLI](/cli/azure/install-azure-cli). To ensure you're running the latest version of the Azure CLI, run the following command.
156
+
- To ensure you're running the latest version of the [Azure CLI](/cli/azure/install-azure-cli), run the following command.
23
157
24
158
```azurecli
25
159
az upgrade
@@ -77,7 +211,7 @@ az group create \
77
211
--location $LOCATION
78
212
```
79
213
80
-
1. Retrieve the environment ID. You use this to configure the environment.
214
+
1. Retrieve the environment ID. You use this ID to configure the environment.
81
215
82
216
```azurecli
83
217
ENVIRONMENT_ID=$(az containerapp env show \
@@ -121,11 +255,17 @@ az group create \
121
255
--output tsv)
122
256
```
123
257
124
-
If you browse to the container app endpoint, you receive `ERR_CONNECTION_CLOSED` because the container app environment has public access disabled. Instead, you use an AFD endpoint to access your container app.
258
+
1. When you browse to the container app endpoint, you receive `ERR_CONNECTION_CLOSED` because the container app environment has public access disabled. Instead, you use an AFD endpoint to access your container app.
125
259
126
260
## Create an Azure Front Door profile
127
261
128
-
Create an AFD profile. Private link is not supported for origins in an AFD profile with SKU `Standard_AzureFrontDoor`.
262
+
1. Make sure the `Microsoft.Cdn` resource provider is registered for your subscription.
263
+
264
+
```azurecli
265
+
az provider register --namespace Microsoft.Cdn
266
+
```
267
+
268
+
1. Create an AFD profile. Private link isn't supported for origins in an AFD profile with SKU `Standard_AzureFrontDoor`.
Run the following command to approve the connection. Replace the \<PLACEHOLDER\> with the private endpoint connection resource ID you recorded in the previous section.
353
+
To approve the connection, run the following command. Replace the \<PLACEHOLDER\> with the private endpoint connection resource ID you recorded in the previous section.
214
354
215
355
```azurecli
216
356
az network private-endpoint-connection approve --id <PRIVATE_ENDPOINT_CONNECTION_RESOURCE_ID>
217
357
```
218
358
219
359
## Add a route
220
360
221
-
Run the following command to map the endpoint you created earlier to the origin group. Private endpoints on Azure Container Apps only support inbound HTTP traffic. TCP traffic is not supported.
361
+
Run the following command to map the endpoint you created earlier to the origin group. Private endpoints on Azure Container Apps only support inbound HTTP traffic. TCP traffic isn't supported.
222
362
223
363
```azurecli
224
364
az afd route create \
@@ -254,19 +394,24 @@ az afd route create \
254
394
255
395
1. Browse to the hostname. You see the output for the quickstart container app image.
256
396
257
-
It takes a few minutes for your AFD profile to be deployed globally, so if you do not see the expected output at first, wait a few minutes and then refresh.
397
+
If you don't see the expected output at first, wait a few minutes and then refresh.
258
398
259
399
## Clean up resources
260
400
261
-
If you're not going to continue to use this application, you can remove the **my-container-apps** resource group. This deletes the Azure Container Apps instance and all associated services. It also deletes the resource group that the Container Apps service automatically created and which contains the custom network components.
401
+
If you're not going to continue to use this application, you can remove the **my-container-apps** resource group. This action deletes the Azure Container Apps instance and all associated services. It also deletes the resource group that the Container Apps service automatically created and which contains the custom network components.
262
402
263
403
> [!CAUTION]
264
-
> The following command deletes the specified resource group and all resources contained within it. If resources outside the scope of this guide exist in the specified resource group, they will also be deleted.
404
+
> The following command deletes the specified resource group and all resources contained within it. If resources outside the scope of this guide exist in the specified resource group, they'll also be deleted.
265
405
266
406
```azurecli
267
407
az group delete --name $RESOURCE_GROUP
268
408
```
269
409
410
+
::: zone-end
411
+
412
+
> [!TIP]
413
+
> Having issues? Let us know on GitHub by opening an issue in the [Azure Container Apps repo](https://github.com/microsoft/azure-container-apps).
0 commit comments