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
Copy file name to clipboardExpand all lines: articles/frontdoor/standard-premium/create-front-door-cli.md
+77-74Lines changed: 77 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Create an Azure Front Door Standard/Premium with the Azure CLI
3
-
description: Learn how to create an Azure Front Door Standard/Premium (preview) with the Azure CLI. Use the Front Door to protect your web apps against vulnerabilities.
2
+
title: Create an Azure Front Door Premium with the Azure CLI
3
+
description: Learn how to create an Azure Front Door Premium with Azure CLI. Use Azure Front Door to deliver content to your global user base and protect your web apps against vulnerabilities.
# Quickstart: Create an Azure Front Door Standard/Premium - Azure CLI
13
+
# Quickstart: Create an Azure Front Door Premium - Azure CLI
14
14
15
-
In this quickstart, you'll learn how to create an Azure Front Door Standard/Premium profile using the Azure CLI. You'll create this profile using two Web Apps as your origin, and add a WAF security policy. You can then verify connectivity to your Web Apps using the Azure Front Door Standard/Premium frontend hostname.
15
+
In this quickstart, you'll learn how to create an Azure Front Door Premium profile using Azure CLI. You'll create this profile using two Web Apps as your origin, and add a WAF security policy. You can then verify connectivity to your Web Apps using the Azure Front Door endpoint hostname.
16
16
17
17
> [!NOTE]
18
-
> This documentation is for Azure Front Door Standard/Premium (Preview). Looking for information on Azure Front Door? View [Azure Front Door Docs](../front-door-overview.md).
18
+
> This documentation is for Azure Front Door Standard/Premium. Looking for information on Azure Front Door? View [Azure Front Door Docs](../front-door-overview.md).
For this quickstart, you'll need two resource groups. One in *Central US* and the second in *East US*.
26
+
In Azure, you allocate related resources to a resource group. You can either use an existing resource group or create a new one.
27
27
28
-
Run [az group create](/cli/azure/group#az-group-create) to create resource groups.
28
+
Run [az group create](/cli/azure/group) to create resource groups.
29
29
30
30
```azurecli
31
-
az group create \
32
-
--name myRGFDCentral \
33
-
--location centralus
34
-
35
-
az group create \
36
-
--name myRGFDEast \
37
-
--location eastus
31
+
az group create --name myRGFD --location centralus
38
32
```
39
-
40
33
## Create an Azure Front Door profile
41
34
42
35
Run [az afd profile create](/cli/azure/afd/profile#az-afd-profile-create) to create an Azure Front Door profile.
43
36
44
37
```azurecli
45
38
az afd profile create \
46
39
--profile-name contosoafd \
47
-
--resource-group myRGFDCentral \
48
-
--sku Premium_AzureFrontDoor \
49
-
--subscription mysubscription
40
+
--resource-group myRGFD \
41
+
--sku Premium_AzureFrontDoor
50
42
```
51
43
52
44
## Create two instances of a web app
@@ -64,31 +56,27 @@ Run [az appservice plan create](/cli/azure/appservice/plan#az-appservice-plan-cr
64
56
```azurecli
65
57
az appservice plan create \
66
58
--name myAppServicePlanCentralUS \
67
-
--resource-group myRGFDCentral
59
+
--resource-group myRGFD
68
60
69
61
az appservice plan create \
70
62
--name myAppServicePlanEastUS \
71
-
--resource-group myRGFDEast
63
+
--resource-group myRGFD
72
64
```
73
65
74
66
### Create web apps
75
67
76
68
Run [az webapp create](/cli/azure/webapp#az-webapp-create&preserve-view=true) to create a web app in each of the app service plans in the previous step. Web app names have to be globally unique.
77
69
78
-
Run [az webapp list-runtimes](/cli/azure/webapp#az-webapp-create&preserve-view=true) to see a list of built-in stacks for web apps.
79
-
80
70
```azurecli
81
71
az webapp create \
82
-
--name WebAppContoso-001 \
83
-
--resource-group myRGFDCentral \
84
-
--plan myAppServicePlanCentralUS \
85
-
--runtime "DOTNETCORE|2.1"
72
+
--name WebAppContoso-01 \
73
+
--resource-group myRGFD \
74
+
--plan myAppServicePlanCentralUS
86
75
87
76
az webapp create \
88
-
--name WebAppContoso-002 \
89
-
--resource-group myRGFDEast \
90
-
--plan myAppServicePlanEastUS \
91
-
--runtime "DOTNETCORE|2.1"
77
+
--name WebAppContoso-02 \
78
+
--resource-group myRGFD \
79
+
--plan myAppServicePlanEastUS
92
80
```
93
81
94
82
Make note of the default host name of each web app so you can define the backend addresses when you deploy the Front Door in the next step.
@@ -99,10 +87,9 @@ Run [az afd endpoint create](/cli/azure/afd/endpoint#az-afd-endpoint-create) to
99
87
100
88
```azurecli
101
89
az afd endpoint create \
102
-
--resource-group myRGFDCentral \
103
-
--endpoint-name contoso-frontend \
90
+
--resource-group myRGFD \
91
+
--endpoint-name contosofrontend \
104
92
--profile-name contosoafd \
105
-
--origin-response-timeout-seconds 60 \
106
93
--enabled-state Enabled
107
94
```
108
95
@@ -112,13 +99,13 @@ Run [az afd origin-group create](/cli/azure/afd/origin-group#az-afd-origin-group
112
99
113
100
```azurecli
114
101
az afd origin-group create \
115
-
--resource-group myRGFDCentral \
116
-
--origin-group-name og1 \
102
+
--resource-group myRGFD \
103
+
--origin-group-name og2 \
117
104
--profile-name contosoafd \
118
105
--probe-request-type GET \
119
106
--probe-protocol Http \
120
-
--probe-interval-in-seconds 120 \
121
-
--probe-path /test1/azure.txt \
107
+
--probe-interval-in-seconds 60 \
108
+
--probe-path / \
122
109
--sample-size 4 \
123
110
--successful-samples-required 3 \
124
111
--additional-latency-in-milliseconds 50
@@ -130,12 +117,12 @@ Run [az afd origin create](/cli/azure/afd/origin#az-afd-origin-create) to add an
Run [az afd route create](/cli/azure/afd/route#az-afd-route-create) to map your frontend endpoint to the origin group. This route forwards requests from the endpoint to *og1*.
152
+
Run [az afd route create](/cli/azure/afd/route#az-afd-route-create) to map your endpoint to the origin group. This route forwards requests from the endpoint to your origin group.
166
153
167
154
```azurecli
168
155
az afd route create \
169
-
--resource-group myRGFDCentral \
170
-
--endpoint-name contoso-frontend \
156
+
--resource-group myRGFD \
171
157
--profile-name contosoafd \
172
-
--route-name route1 \
158
+
--endpoint-name contosofrontend \
159
+
--forwarding-protocol MatchRequest \
160
+
--route-name route \
173
161
--https-redirect Enabled \
174
-
--origin-group og1 \
175
-
--supported-protocols Https \
176
-
--link-to-default-domain Enabled \
177
-
--forwarding-protocol MatchRequest
162
+
--origin-group og \
163
+
--supported-protocols Http Https \
164
+
--link-to-default-domain Enabled
178
165
```
179
166
180
167
## Create a new security policy
181
168
182
169
### Create a WAF policy
183
170
184
-
Run [az network front-door waf-policy create](/cli/azure/network/front-door/waf-policy#az-network-front-door-waf-policy-create) to create a WAF policy for one of your resource groups.
185
-
186
-
Create a new WAF policy for your Front Door. This example creates a policy that's enabled and in prevention mode.
171
+
Run [az network front-door waf-policy create](/cli/azure/network/front-door/waf-policy#az-network-front-door-waf-policy-create) to create a new WAF policy for your Front Door. This example creates a policy that is enabled and in prevention mode.
187
172
188
173
```azurecli
189
-
az network front-door waf-policy create
190
-
--name contosoWAF /
191
-
--resource-group myRGFDCentral /
192
-
--sku Premium_AzureFrontDoor
193
-
--disabled false /
174
+
az network front-door waf-policy create \
175
+
--name contosoWAF \
176
+
--resource-group myRGFD \
177
+
--sku Premium_AzureFrontDoor \
178
+
--disabled false \
194
179
--mode Prevention
195
180
```
196
181
@@ -201,26 +186,40 @@ az network front-door waf-policy create
201
186
202
187
Run [az afd security-policy create](/cli/azure/afd/security-policy#az-afd-security-policy-create) to apply your WAF policy to the endpoint's default domain.
203
188
189
+
> [!NOTE]
190
+
> Substitute 'mysubscription' with your Azure Subscription ID in the domains and waf-policy parameters below. Run [az account subscription list](/cli/azure/aaccount/subscription#az-account-subscription-list) to get Subscription ID details.
When you create the Azure Front Door Standard/Premium profile, it takes a few minutes for the configuration to be deployed globally. Once completed, you can access the frontend host you created. In a browser, go to `contoso-frontend.z01.azurefd.net`. Your request will automatically get routed to the nearest server from the specified servers in the origin group.
204
+
When you create the Azure Front Door Standard/Premium profile, it takes a few minutes for the configuration to be deployed globally. Once completed, you can access the frontend host you created.
216
205
217
-
To test instant global failover, we'll use the following steps:
206
+
Run [az afd endpoint show](/cli/azure/afd/endpoint#az-afd-endpoint-show) to get the hostname of the Front Door endpoint.
218
207
219
-
1. Open a browser, as described above, and go to the frontend address: `contoso-frontend.azurefd.net`.
208
+
```azurecli
209
+
az afd endpoint show --resource-group myRGFD --profile-name contosoafd --endpoint-name contosofrontend
210
+
```
211
+
In a browser, go to the endpoint hostname: `contosofrontend-<hash>.z01.azurefd.net`. Your request will automatically get routed to the least latent Web App in the origin group.
220
212
221
-
2. In the Azure portal, search for and select *App services*. Scroll down to find one of your web apps, **WebAppContoso-1** in this example.
222
213
223
-
3. Select your web app, and then select **Stop**, and **Yes** to verify.
214
+
215
+
To test instant global failover, we'll use the following steps:
216
+
217
+
1. Open a browser, as described above, and go to the endpoint hostname: `contosofrontend-<hash>.z01.azurefd.net`.
218
+
219
+
2. Stop one of the Web Apps by running [az webapp stop](/cli/azure/webapp#az-webapp-stop&preserve-view=true)
220
+
```azurecli
221
+
az webapp stop --name WebAppContoso-01 --resource-group myRGFD
222
+
```
224
223
225
224
4. Refresh your browser. You should see the same information page.
226
225
@@ -229,10 +228,17 @@ To test instant global failover, we'll use the following steps:
229
228
230
229
5. Find the other web app, and stop it as well.
231
230
231
+
```azurecli
232
+
az webapp stop --name WebAppContoso-02 --resource-group myRGFD
233
+
```
234
+
232
235
6. Refresh your browser. This time, you should see an error message.
233
236
234
-
:::image type="content" source="../media/create-front-door-portal/web-app-stopped-message.png" alt-text="Both instances of the web app stopped":::
237
+
7. Restart one of the Web Apps by running [az webapp start](/cli/azure/webapp#az-webapp-start&preserve-view=true). Refresh your browser and the page will go back to normal.
235
238
239
+
```azurecli
240
+
az webapp start --name WebAppContoso-01 --resource-group myRGFD
241
+
```
236
242
## Clean up resources
237
243
238
244
When you don't need the resources for the Front Door, delete both resource groups. Deleting the resource groups also deletes the Front Door and all its related resources.
@@ -241,10 +247,7 @@ Run [az group delete](/cli/azure/group#az-group-delete&preserve-view=true):
0 commit comments