Skip to content

Commit 33443eb

Browse files
Merge pull request #287087 from duongau/privateappgw
Front Door - Private Link to Application Gateway (new article)
2 parents 00fbd23 + a023686 commit 33443eb

File tree

3 files changed

+271
-0
lines changed

3 files changed

+271
-0
lines changed

articles/frontdoor/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@
322322
href: standard-premium/how-to-enable-private-link-web-app.md
323323
- name: Azure CLI
324324
href: standard-premium/how-to-enable-private-link-web-app-cli.md
325+
- name: Connect to an application gateway
326+
href: how-to-enable-private-link-application-gateway.md
325327
- name: Monitor and reports
326328
items:
327329
- name: Configure diagnostic logs
Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
---
2+
title: 'Connect Azure Front Door Premium to an Azure Application Gateway origin with Private Link (Preview)'
3+
titleSuffix: Azure Private Link
4+
description: Learn how to connect your Azure Front Door Premium to an Azure Application Gateway privately.
5+
services: frontdoor
6+
author: duongau
7+
ms.service: azure-frontdoor
8+
ms.topic: how-to
9+
ms.date: 09/23/2024
10+
ms.author: duau
11+
zone_pivot_groups: front-door-dev-exp-ps-cli
12+
ms.custom: ai-usage
13+
---
14+
15+
# Connect Azure Front Door Premium to an Azure Application Gateway with Private Link (Preview)
16+
17+
This article guides you through the steps to configure an Azure Front Door Premium to connect privately to your Azure Application Gateway using Azure Private Link.
18+
19+
::: zone pivot="front-door-ps"
20+
21+
## Prerequisites
22+
23+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
24+
25+
- Azure PowerShell installed locally or Azure Cloud Shell.
26+
27+
[!INCLUDE [updated-for-az](~/reusable-content/ce-skilling/azure/includes/updated-for-az.md)]
28+
29+
[!INCLUDE [cloud-shell-try-it.md](~/reusable-content/ce-skilling/azure/includes/cloud-shell-try-it.md)]
30+
31+
- Have a functioning Azure Application Gateway. For more information on how to create an Application Gateway, see [Direct web traffic with Azure Application Gateway using Azure PowerShell](../application-gateway/quick-create-powershell.md)
32+
33+
- Have a functioning Azure Front Door Premium profile and an endpoint. For more information on how to create an Azure Front Door profile, see [Create a Front Door - PowerShell](create-front-door-powershell.md).
34+
35+
- Have a functioning Azure Application Gateway. For more information on how to create an Application Gateway, see [Direct web traffic with Azure Application Gateway using Azure PowerShell](../application-gateway/quick-create-powershell.md)
36+
37+
## Enable private connectivity to Azure Application Gateway
38+
39+
Follow the instructions in [Configure Azure Application Gateway Private Link](../application-gateway/private-link-configure.md), but don't complete the final step of creating a private endpoint.
40+
41+
## Create an origin group and add the application gateway as an origin
42+
43+
1. Use [New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject](/powershell/module/az.cdn/new-azfrontdoorcdnorigingrouphealthprobesettingobject) to create an in-memory object for storing the health probe settings.
44+
45+
```azurepowershell-interactive
46+
$healthProbeSetting = New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject `
47+
-ProbeIntervalInSecond 60 `
48+
-ProbePath "/" `
49+
-ProbeRequestType GET `
50+
-ProbeProtocol Http
51+
```
52+
53+
1. Use [New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject](/powershell/module/az.cdn/new-azfrontdoorcdnorigingrouploadbalancingsettingobject) to create an in-memory object for storing load balancing settings.
54+
55+
```azurepowershell-interactive
56+
$loadBalancingSetting = New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject `
57+
-AdditionalLatencyInMillisecond 50 `
58+
-SampleSize 4 `
59+
-SuccessfulSamplesRequired 3
60+
```
61+
62+
1. Run [New-AzFrontDoorCdnOriginGroup](/powershell/module/az.cdn/new-azfrontdoorcdnorigingroup) to create an origin group that contains your application gateway.
63+
64+
```azurepowershell-interactive
65+
$origingroup = New-AzFrontDoorCdnOriginGroup `
66+
-OriginGroupName myOriginGroup `
67+
-ProfileName myFrontDoorProfile `
68+
-ResourceGroupName myResourceGroup `
69+
-HealthProbeSetting $healthProbeSetting `
70+
-LoadBalancingSetting $loadBalancingSetting
71+
```
72+
73+
1. Get the frontend IP configuration name of the Application Gateway with the [Get-AzApplicationGatewayFrontendIPConfig](/powershell/module/az.network/get-azapplicationgatewayfrontendipconfig) command.
74+
75+
```azurepowershell-interactive
76+
$AppGw = Get-AzApplicationGateway -Name myAppGateway -ResourceGroupName myResourceGroup
77+
$FrontEndIPs= Get-AzApplicationGatewayFrontendIPConfig -ApplicationGateway $AppGw
78+
$FrontEndIPs.name
79+
```
80+
81+
1. Use the [New-AzFrontDoorCdnOrigin](/powershell/module/az.cdn/new-azfrontdoorcdnorigin) command to add your application gateway to the origin group.
82+
83+
```azurepowershell-interactive
84+
New-AzFrontDoorCdnOrigin `
85+
-OriginGroupName myOriginGroup `
86+
-OriginName myAppGatewayOrigin `
87+
-ProfileName myFrontDoorProfile `
88+
-ResourceGroupName myResourceGroup `
89+
-HostName 10.0.0.4 `
90+
-HttpPort 80 `
91+
-HttpsPort 443 `
92+
-OriginHostHeader 10.0.0.4 `
93+
-Priority 1 `
94+
-PrivateLinkId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/myAppGateway `
95+
-SharedPrivateLinkResourceGroupId $FrontEndIPs.name `
96+
-SharedPrivateLinkResourcePrivateLinkLocation CentralUS `
97+
-SharedPrivateLinkResourceRequestMessage 'Azure Front Door private connectivity request' `
98+
-Weight 1000 `
99+
```
100+
101+
> [!NOTE]
102+
> `SharedPrivateLinkResourceGroupId` is the name of the Azure Application Gateway frontend IP configuration.
103+
104+
## Approve the private endpoint
105+
106+
1. Run [Get-AzPrivateEndpointConnection](/powershell/module/az.network/get-azprivateendpointconnection) to retrieve the connection name of the private endpoint connection that needs approval.
107+
108+
```azurepowershell-interactive
109+
Get-AzPrivateEndpointConnection -ResourceGroupName myResourceGroup -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgateways
110+
```
111+
112+
2. Run [Get-AzPrivateEndpointConnection](/powershell/module/az.network/get-azprivateendpointconnection) to retrieve the private endpoint connection details. Use the *Name* value from the output in the next step for approving the connection.
113+
114+
```azurepowershell-interactive
115+
Get-AzPrivateEndpointConnection -Name aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb.bbbbbbbb-1111-2222-3333-cccccccccccc -ResourceGroupName myResourceGroup -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgateways
116+
```
117+
118+
## Complete Azure Front Door setup
119+
120+
Use the [New-AzFrontDoorCdnRoute](/powershell/module/az.cdn/new-azfrontdoorcdnroute) command to create a route that maps your endpoint to the origin group. This route forwards requests from the endpoint to your origin group.
121+
122+
```azurepowershell-interactive
123+
# Create a route to map the endpoint to the origin group
124+
125+
$Route = New-AzFrontDoorCdnRoute `
126+
-EndpointName myFrontDoorEndpoint `
127+
-Name myRoute `
128+
-ProfileName myFrontDoorProfile `
129+
-ResourceGroupName myResourceGroup `
130+
-ForwardingProtocol MatchRequest `
131+
-HttpsRedirect Enabled `
132+
-LinkToDefaultDomain Enabled `
133+
-OriginGroupId $origingroup.Id `
134+
-SupportedProtocol Http,Https
135+
```
136+
137+
Your Azure Front Door profile is now fully functional after completing the final step.
138+
139+
::: zone-end
140+
141+
::: zone pivot="front-door-cli"
142+
143+
[!INCLUDE[azure-cli-prepare-your-environment](~/reusable-content/azure-cli/azure-cli-prepare-your-environment.md)]
144+
145+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
146+
147+
- A functioning Azure Front Door Premium profile and endpoint. See [Create a Front Door - CLI](create-front-door-cli.md).
148+
149+
- A functioning Azure Application Gateway. See [Direct web traffic with Azure Application Gateway - Azure CLI](../application-gateway/quick-create-cli.md).
150+
151+
## Enable private connectivity to Azure Application Gateway
152+
153+
Follow the steps in [Configure Azure Application Gateway Private Link](../application-gateway/private-link-configure.md), skipping the last step of creating a private endpoint.
154+
155+
## Create an origin group and add the application gateway as an origin
156+
157+
1. Run [az afd origin-group create](/cli/azure/afd/origin-group#az-afd-origin-group-create) to create an origin group.
158+
159+
```azurecli-interactive
160+
az afd origin-group create \
161+
--resource-group myResourceGroup \
162+
--origin-group-name myOriginGroup \
163+
--profile-name myFrontDoorProfile \
164+
--probe-request-type GET \
165+
--probe-protocol Http \
166+
--probe-interval-in-seconds 60 \
167+
--probe-path / \
168+
--sample-size 4 \
169+
--successful-samples-required 3 \
170+
--additional-latency-in-milliseconds 50
171+
```
172+
173+
1. Run [az network application-gaeay frontend-ip list](/cli/azure/network/application-gateway/frontend-ip#az-network-application-gateway-frontend-ip-list) to get the frontend IP configuration name of the Application Gateway.
174+
175+
```azurecli-interactive
176+
az network application-gateway frontend-ip list --gateway-name myAppGateway --resource-group myResourceGroup
177+
```
178+
179+
1. Run [az afd origin create](/cli/azure/afd/origin#az-afd-origin-create) to add an application gateway as an origin to the origin group.
180+
181+
```azurecli-interactive
182+
az afd origin create \
183+
--enabled-state Enabled \
184+
--resource-group myResourceGroup \
185+
--origin-group-name myOriginGroup \
186+
--origin-name myAppGatewayOrigin \
187+
--profile-name myFrontDoorProfile \
188+
--host-name 10.0.0.4 \
189+
--origin-host-header 10.0.0.4 \
190+
--http-port 80 \
191+
--https-port 443 \
192+
--priority 1 \
193+
--weight 500 \
194+
--enable-private-link true \
195+
--private-link-location centralus \
196+
--private-link-request-message 'Azure Front Door private connectivity request.' \
197+
--private-link-resource /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myRGAG/providers/Microsoft.Network/applicationGateways/myAppGateway \
198+
--private-link-sub-resource-type myAppGatewayFrontendIPName
199+
```
200+
201+
> [!NOTE]
202+
> `private-link-sub-resource-type` is the Azure Application Gateway frontend IP configuration name.
203+
204+
## Approve the private endpoint connection
205+
206+
1. Run [az network private-endpoint-connection list](/cli/azure/network/private-endpoint-connection#az-network-private-endpoint-connection-list) to get the **id** of the private endpoint connection that needs approval.
207+
208+
```azurecli-interactive
209+
az network private-endpoint-connection list --name myAppGateway --resource-group myResourceGroup --type Microsoft.Network/applicationgateways
210+
```
211+
212+
1. Run [az network private-endpoint-connection approve](/cli/azure/network/private-endpoint-connection#az-network-private-endpoint-connection-approve) to approve the private endpoint connection using the **id** from the previous step.
213+
214+
```azurecli-interactive
215+
az network private-endpoint-connection approve --id /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/myAppGateway/privateEndpointConnections/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb.bbbbbbbb-1111-2222-3333-cccccccccccc
216+
```
217+
218+
## Complete Azure Front Door setup
219+
220+
Run [az afd route create](/cli/azure/afd/route#az-afd-route-create) to create a route that maps your endpoint to the origin group. This route forwards requests from the endpoint to your origin group.
221+
222+
```azurecli-interactive
223+
az afd route create \
224+
--resource-group myResourceGroup \
225+
--profile-name myFrontDoorProfile \
226+
--endpoint-name myFrontDoorEndpoint \
227+
--forwarding-protocol MatchRequest \
228+
--route-name myRoute \
229+
--https-redirect Enabled \
230+
--origin-group myOriginGroup \
231+
--supported-protocols Http Https \
232+
--link-to-default-domain Enabled
233+
```
234+
235+
Your Azure Front Door profile is now fully functional after completing the final step.
236+
237+
::: zone-end
238+
239+
## Common mistakes to avoid
240+
241+
The following are common mistakes when configuring an Azure Application Gateway origin with Azure Private Link enabled:
242+
243+
1. Configuring Azure Front Door origin before configuring Azure Private Link on the Azure Application Gateway.
244+
245+
1. Adding the Azure Application Gateway origin with Azure Private Link to an existing origin group that contains public origins. Azure Front Door doesn't allow mixing public and private origins in the same origin group.
246+
247+
::: zone pivot="front-door-ps"
248+
249+
3. Providing an incorrect Azure Application Gateway frontend IP configuration name as the value for `SharedPrivateLinkResourceGroupId`.
250+
251+
::: zone-end
252+
253+
::: zone pivot="front-door-cli"
254+
255+
3. Providing an incorrect Azure Application Gateway frontend IP configuration name as the value for `private-link-sub-resource-type`.
256+
257+
::: zone-end
258+
259+
## Next steps
260+
261+
Learn about [Private Link service with storage account](../storage/common/storage-private-endpoints.md).

articles/zone-pivot-groups.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,14 @@ groups:
11601160
title: Azure portal
11611161
- id: front-door-cli
11621162
title: Azure CLI
1163+
- id: front-door-dev-exp-ps-cli
1164+
title: Front Door Developer experience
1165+
prompt: "Select the developer experience:"
1166+
pivots:
1167+
- id: front-door-ps
1168+
title: Azure PowerShell
1169+
- id: front-door-cli
1170+
title: Azure CLI
11631171
# Owner: wiassaf
11641172
- id: azure-sql-deployment-option-single-elastic
11651173
title: Azure SQL deployment option, single or elastic

0 commit comments

Comments
 (0)