Skip to content

Commit c1d2877

Browse files
committed
fixed ps and cli commands
1 parent 8597b6f commit c1d2877

File tree

1 file changed

+75
-57
lines changed

1 file changed

+75
-57
lines changed

articles/frontdoor/how-to-enable-private-link-application-gateway.md

Lines changed: 75 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: frontdoor
66
author: duongau
77
ms.service: azure-frontdoor
88
ms.topic: how-to
9-
ms.date: 09/20/2024
9+
ms.date: 09/23/2024
1010
ms.author: duau
1111
zone_pivot_groups: front-door-dev-exp-ps-cli
1212
ms.custom: ai-usage
@@ -43,9 +43,7 @@ Follow the instructions in [Configure Azure Application Gateway Private Link](..
4343
1. Use [New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject](/powershell/module/az.cdn/new-azfrontdoorcdnorigingrouphealthprobesettingobject) to create an in-memory object for storing the health probe settings.
4444

4545
```azurepowershell-interactive
46-
# Create health probe settings
47-
48-
$HealthProbeSetting = New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject `
46+
$healthProbeSetting = New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject `
4947
-ProbeIntervalInSecond 60 `
5048
-ProbePath "/" `
5149
-ProbeRequestType GET `
@@ -55,9 +53,7 @@ Follow the instructions in [Configure Azure Application Gateway Private Link](..
5553
1. Use [New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject](/powershell/module/az.cdn/new-azfrontdoorcdnorigingrouploadbalancingsettingobject) to create an in-memory object for storing load balancing settings.
5654
5755
```azurepowershell-interactive
58-
# Create load balancing settings
59-
60-
$LoadBalancingSetting = New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject `
56+
$loadBalancingSetting = New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject `
6157
-AdditionalLatencyInMillisecond 50 `
6258
-SampleSize 4 `
6359
-SuccessfulSamplesRequired 3
@@ -66,51 +62,57 @@ Follow the instructions in [Configure Azure Application Gateway Private Link](..
6662
1. Run [New-AzFrontDoorCdnOriginGroup](/powershell/module/az.cdn/new-azfrontdoorcdnorigingroup) to create an origin group that contains your application gateway.
6763
6864
```azurepowershell-interactive
69-
# Create origin group
70-
71-
$originpool = New-AzFrontDoorCdnOriginGroup `
72-
-OriginGroupName og `
73-
-ProfileName contosoAFD `
74-
-ResourceGroupName myRGFD `
75-
-HealthProbeSetting $HealthProbeSetting `
76-
-LoadBalancingSetting $LoadBalancingSetting
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
7779
```
7880
7981
1. Use the [New-AzFrontDoorCdnOrigin](/powershell/module/az.cdn/new-azfrontdoorcdnorigin) command to add your application gateway to the origin group.
8082
8183
```azurepowershell-interactive
8284
New-AzFrontDoorCdnOrigin `
83-
-OriginGroupName og `
84-
-OriginName appgatewayorigin `
85-
-ProfileName contosoAFD `
86-
-ResourceGroupName myRGFD `
85+
-OriginGroupName myOriginGroup `
86+
-OriginName myAppGatewayOrigin `
87+
-ProfileName myFrontDoorProfile `
88+
-ResourceGroupName myResourceGroup `
8789
-HostName 10.0.0.4 `
8890
-HttpPort 80 `
8991
-HttpsPort 443 `
9092
-OriginHostHeader 10.0.0.4 `
9193
-Priority 1 `
92-
-PrivateLinkId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myRGAG/providers/Microsoft.Network/applicationGateways/myAppGateway `
93-
-SharedPrivateLinkResourceGroupId appGwPublicFrontendIp `
94+
-PrivateLinkId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/myAppGateway `
95+
-SharedPrivateLinkResourceGroupId $FrontEndIPs.name `
9496
-SharedPrivateLinkResourcePrivateLinkLocation CentralUS `
95-
-SharedPrivateLinkResourceRequestMessage 'AFD Private Link request' `
97+
-SharedPrivateLinkResourceRequestMessage 'Azure Front Door private connectivity request' `
9698
-Weight 1000 `
9799
```
98100
99101
> [!NOTE]
100-
> 'SharedPrivateLinkResourceGroupId' is the same as the Application Gateway frontend IP configuration. This value may be different for different frontend IP configurations.
102+
> `SharedPrivateLinkResourceGroupId` is the name of the Azure Application Gateway frontend IP configuration.
101103
102104
## Approve the private endpoint
103105
104106
1. Run [Get-AzPrivateEndpointConnection](/powershell/module/az.network/get-azprivateendpointconnection) to retrieve the connection name of the private endpoint connection that needs approval.
105107
106108
```azurepowershell-interactive
107-
Get-AzPrivateEndpointConnection -ResourceGroupName myRGAG -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgateways
109+
Get-AzPrivateEndpointConnection -ResourceGroupName myResourceGroup -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgateways
108110
```
109111
110112
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.
111113
112114
```azurepowershell-interactive
113-
Get-AzPrivateEndpointConnection -Name aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb.bbbbbbbb-1111-2222-3333-cccccccccccc -ResourceGroupName myRGAG -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgateways
115+
Get-AzPrivateEndpointConnection -Name aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb.bbbbbbbb-1111-2222-3333-cccccccccccc -ResourceGroupName myResourceGroup -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgateways
114116
```
115117
116118
## Complete Azure Front Door setup
@@ -121,14 +123,14 @@ Use the [New-AzFrontDoorCdnRoute](/powershell/module/az.cdn/new-azfrontdoorcdnro
121123
# Create a route to map the endpoint to the origin group
122124
123125
$Route = New-AzFrontDoorCdnRoute `
124-
-EndpointName contosofrontend `
125-
-Name defaultroute `
126-
-ProfileName contosoAFD `
127-
-ResourceGroupName myRGFD `
126+
-EndpointName myFrontDoorEndpoint `
127+
-Name myRoute `
128+
-ProfileName myFrontDoorProfile `
129+
-ResourceGroupName myResourceGroup `
128130
-ForwardingProtocol MatchRequest `
129131
-HttpsRedirect Enabled `
130132
-LinkToDefaultDomain Enabled `
131-
-OriginGroupId og `
133+
-OriginGroupId $origingroup.Id `
132134
-SupportedProtocol Http,Https
133135
```
134136

@@ -156,9 +158,9 @@ Follow the steps in [Configure Azure Application Gateway Private Link](../applic
156158

157159
```azurecli-interactive
158160
az afd origin-group create \
159-
--resource-group myRGFD \
160-
--origin-group-name og \
161-
--profile-name contosoafd \
161+
--resource-group myResourceGroup \
162+
--origin-group-name myOriginGroup \
163+
--profile-name myFrontDoorProfile \
162164
--probe-request-type GET \
163165
--probe-protocol Http \
164166
--probe-interval-in-seconds 60 \
@@ -168,15 +170,21 @@ Follow the steps in [Configure Azure Application Gateway Private Link](../applic
168170
--additional-latency-in-milliseconds 50
169171
```
170172
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+
171179
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.
172180
173181
```azurecli-interactive
174182
az afd origin create \
175183
--enabled-state Enabled \
176-
--resource-group myRGFD \
177-
--origin-group-name og \
178-
--origin-name appgwog \
179-
--profile-name contosoafd \
184+
--resource-group myResourceGroup \
185+
--origin-group-name myOriginGroup \
186+
--origin-name myAppGatewayOrigin \
187+
--profile-name myFrontDoorProfile \
180188
--host-name 10.0.0.4 \
181189
--origin-host-header 10.0.0.4 \
182190
--http-port 80 \
@@ -185,41 +193,41 @@ Follow the steps in [Configure Azure Application Gateway Private Link](../applic
185193
--weight 500 \
186194
--enable-private-link true \
187195
--private-link-location centralus \
188-
--private-link-request-message 'AFD Private Link request.' \
196+
--private-link-request-message 'Azure Front Door private connectivity request.' \
189197
--private-link-resource /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myRGAG/providers/Microsoft.Network/applicationGateways/myAppGateway \
190-
--private-link-sub-resource-type appGwPublicFrontendIp
198+
--private-link-sub-resource-type myAppGatewayFrontendIPName
191199
```
192200
193-
> [!NOTE]
194-
> `SharedPrivateLinkResourceGroupId` is the same as the Application Gateway frontend IP configuration. This value may be different for different frontend IP configurations.
201+
> [!NOTE]
202+
> `private-link-sub-resource-type` is the Azure Application Gateway frontend IP configuration name.
195203
196204
## Approve the private endpoint connection
197205
198-
1. Retrieve the list of private endpoint connections:
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.
199207
200208
```azurecli-interactive
201-
az network private-endpoint-connection list --name myAppGateway --resource-group myRGAG --type Microsoft.Network/applicationgateways
209+
az network private-endpoint-connection list --name myAppGateway --resource-group myResourceGroup --type Microsoft.Network/applicationgateways
202210
```
203211
204-
1. Approve the private endpoint connection:
205-
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.
206213
207214
```azurecli-interactive
208-
az network private-endpoint-connection approve --id /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myRGAG/providers/Microsoft.Network/applicationGateways/myAppGateway/privateEndpointConnections/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb.bbbbbbbb-1111-2222-3333-cccccccccccc
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
209216
```
210217
211-
1. Add a route to map the endpoint to the origin group:
218+
## Complete Azure Front Door setup
219+
220+
1. 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.
212221
213222
```azurecli-interactive
214223
az afd route create \
215-
--resource-group myRGFD \
216-
--profile-name contosoafd \
217-
--endpoint-name contosofrontend \
224+
--resource-group myResourceGroup \
225+
--profile-name myFrontDoorProfile \
226+
--endpoint-name myFrontDoorEndpoint \
218227
--forwarding-protocol MatchRequest \
219-
--route-name route \
220-
--route-name route \
228+
--route-name myRoute \
221229
--https-redirect Enabled \
222-
--origin-group og \
230+
--origin-group myOriginGroup \
223231
--supported-protocols Http Https \
224232
--link-to-default-domain Enabled
225233
```
@@ -230,13 +238,23 @@ Your Azure Front Door profile is now fully functional after completing the final
230238
231239
## Common mistakes to avoid
232240
233-
The following are common mistakes when configuring an application gateway origin with Private Link enabled:
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+
1. Providing an incorrect Azure Application Gateway frontend IP configuration name as the value for `SharedPrivateLinkResourceGroupId`.
234250
235-
1. Not configuring Private Link before starting the Azure Front Door creation steps.
251+
::: zone-end
236252
237-
1. Adding the Azure Application Gateway origin with Private Link to an existing origin group that contains public origins. Front Door doesn't allow mixing public and private origins in the same origin group.
253+
::: zone pivot="front-door-cli"
238254
239-
1. Providing an incorrect Azure Application Gateway frontend IP configuration name as the value for `GroupId`.
255+
1. Providing an incorrect Azure Application Gateway frontend IP configuration name as the value for `private-link-sub-resource-type`.
256+
257+
::: zone-end
240258
241259
## Next steps
242260

0 commit comments

Comments
 (0)