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
@@ -3,13 +3,9 @@ title: Create an application gateway with URL path-based routing rules - Azure p
3
3
description: Learn how to create URL path-based routing rules for an application gateway and virtual machine scale set using the Azure portal.
4
4
services: application-gateway
5
5
author: vhorne
6
-
manager: jpconnock
7
-
tags: azure-resource-manager
8
-
9
6
ms.service: application-gateway
10
7
ms.topic: article
11
-
ms.workload: infrastructure-services
12
-
ms.date: 3/26/2018
8
+
ms.date: 08/31/2019
13
9
ms.author: victorh
14
10
15
11
---
@@ -36,144 +32,181 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
36
32
37
33
Log in to the Azure portal at [https://portal.azure.com](https://portal.azure.com)
38
34
39
-
## Create an application gateway
35
+
## Create virtual machines
40
36
41
-
A virtual network is needed for communication between the resources that you create. Two subnets are created in this example: one for the application gateway, and the other for the backend servers. You can create a virtual network at the same time that you create the application gateway.
37
+
In this example, you create three virtual machines to be used as backend servers for the application gateway. You also install IIS on the virtual machines to verify that the application gateway was successfully created.
42
38
43
-
1.Click **New** found on the upper left-hand corner of the Azure portal.
44
-
2. Select **Networking** and then select **Application Gateway**in the Featured list.
45
-
3. Enter these values for the application gateway:
39
+
1.On the Azure portal, select **Create a resource**.
40
+
2. Select **Windows Server 2016 Datacenter**in the Popular list.
41
+
3. Enter these values for the virtual machine:
46
42
47
-
-*myAppGateway* - for the name of the application gateway.
48
-
-*myResourceGroupAG* - for the new resource group.
43
+
-**Resource group**, select **Create new**, and then type *myResourceGroupAG*.
44
+
-**Virtual machine name**: *myVM1*
45
+
-**Region**: *(US) East US*
46
+
-**Username**: *azureuser*
47
+
-**Password**: *Azure123456!*
49
48
50
-

51
49
52
-
4. Accept the default values for the other settings and then click **OK**.
53
-
5. Click **Choose a virtual network**, click **Create new**, and then enter these values for the virtual network:
50
+
4. Select **Next:Disks**.
51
+
5. Select **Next:Networking**
52
+
6. Select **Create new** and then type these values for the virtual network:
54
53
55
54
-*myVNet* - for the name of the virtual network.
56
55
-*10.0.0.0/16* - for the virtual network address space.
8. Ensure that under **Network Interface**, **myBackendSubnet** is selected for the subnet, and then select **Next: Management**.
63
+
9. Select **Off** to disable boot diagnostics.
64
+
10. Click **Review + Create**, review the settings on the summary page, and then select **Create**.
65
+
11. Create two more virtual machines, *myVM2* and *myVM3* and place them in the *MyVNet* virtual network and the *myBackendSubnet* subnet.
61
66
62
-
6. Click **OK** to create the virtual network and subnet.
63
-
7. Click **Choose a public IP address**, click **Create new**, and then enter the name of the public IP address. In this example, the public IP address is named *myAGPublicIPAddress*. Accept the default values for the other settings and then click **OK**.
64
-
8. Accept the default values for the Listener configuration, leave the Web application firewall disabled, and then click **OK**.
65
-
9. Review the settings on the summary page, and then click **OK** to create the network resources and the application gateway. It may take several minutes for the application gateway to be created, wait until
66
-
the deployment finishes successfully before moving on to the next section.
67
+
### Install IIS
67
68
68
-
### Add a subnet
69
+
1. Open the interactive shell and make sure that it is set to **PowerShell**.
69
70
70
-
1. Click **All resources** in the left-hand menu, and then click **myVNet** from the resources list.
3. Create two more virtual machines and install IIS using the steps that you just finished. Enter the names of *myVM2* and *myVM3* for the names and for the values of VMName in Set-AzVMExtension.
78
89
79
-
In this example, you create three virtual machines to be used as backend servers for the application gateway. You also install IIS on the virtual machines to verify that the application gateway was successfully created.
90
+
## Create an application gateway
80
91
81
-
1. Click **New**.
82
-
2. Click **Compute** and then select **Windows Server 2016 Datacenter** in the Featured list.
83
-
3. Enter these values for the virtual machine:
92
+
1. Select **Create a resource** on the left menu of the Azure portal. The **New** window appears.
84
93
85
-
-*myVM1* - for the name of the virtual machine.
86
-
-*azureuser* - for the administrator user name.
87
-
-*Azure123456!* for the password.
88
-
- Select **Use existing**, and then select *myResourceGroupAG*.
94
+
2. Select **Networking** and then select **Application Gateway** in the **Featured** list.
89
95
90
-
4. Click **OK**.
91
-
5. Select **DS1_V2** for the size of the virtual machine, and click **Select**.
92
-
6. Make sure that **myVNet** is selected for the virtual network and the subnet is **myBackendSubnet**.
93
-
7. Click **Disabled** to disable boot diagnostics.
94
-
8. Click **OK**, review the settings on the summary page, and then click **Create**.
96
+
### Basics tab
95
97
96
-
### Install IIS
98
+
1. On the **Basics** tab, enter these values for the following application gateway settings:
97
99
98
-
1. Open the interactive shell and make sure that it is set to **PowerShell**.
100
+
- **Resource group**: Select **myResourceGroupAG** for the resource group. If it doesn't exist, select **Create new** to create it.
101
+
- **Application gateway name**: Enter *myAppGateway* for the name of the application gateway.
3. Create two more virtual machines and install IIS using the steps that you just finished. Enter the names of *myVM2* and *myVM3* for the names and for the values of VMName in Set-AzVMExtension.
112
+
1. On the **Frontends** tab, verify **Frontend IP address type** is set to **Public**.
113
+
114
+
You can configure the Frontend IP to be Public or Private as per your use case. In this example, you'll choose a Public Frontend IP.
115
+
> [!NOTE]
116
+
> For the Application Gateway v2 SKU, you can only choose **Public** frontend IP configuration. Private frontend IP configuration is currently not enabled for this v2 SKU.
117
+
118
+
2. Choose **Create new** for the **Public IP address** and enter *myAGPublicIPAddress* for the public IP address name, and then select **OK**.
119
+
120
+

118
121
119
-
## Create backend pools with the virtual machines
122
+
3. Select **Next: Backends**.
120
123
121
-
1. Click **All resources** and then click **myAppGateway**.
122
-
2. Click **Backend pools**. A default pool was automatically created with the application gateway. Click **appGatewayBackendPool**.
123
-
3. Click **Add target** to add *myVM1* to appGatewayBackendPool.
The backend pool is used to route requests to the backend servers that serve the request. Backend pools can be composed of NICs, virtual machine scale sets, public IPs, internal IPs, fully qualified domain names (FQDN), and multi-tenant back-ends like Azure App Service.
126
127
127
-
4. Click **Save**.
128
-
5. Click **Backend pools** and then click **Add**.
129
-
6. Enter a name of *imagesBackendPool* and add *myVM2* using **Add target**.
130
-
7. Click **OK**.
131
-
8. Click **Add** again to add another backend pool with a name of *videoBackendPool* and add *myVM3* to it.
128
+
1. On the **Backends** tab, select **+Add a backend pool**.
132
129
133
-
## Create a backend listener
130
+
2. In the **Add a backend pool** window that opens, enter the following values to create an empty backend pool:
134
131
135
-
1. Click **Listeners** and the click **Basic**.
136
-
2. Enter *myBackendListener* for the name, *myFrontendPort* for the name of the frontend port, and then *8080* as the port for the listener.
137
-
3. Click **OK**.
132
+
- **Name**: Enter *myBackendPool* for the name of the backend pool.
133
+
3. Under **Backend Targets**, select **Virtual machine** from the drop-down list.
138
134
139
-
## Create a path-based routing rule
135
+
5. Under **Target** select the network interface for **myVM1**
136
+
6. Repeat to add an *Images* backend pool with *myVM2* as the target, and a *Video* backend pool with *myVM3* as the target.
137
+
3. Select **Add** to save the backend pool configuration and return to the **Backends** tab.
140
138
141
-
1. Click **Rules** and then click **Path-based**.
142
-
2. Enter *rule2* for the name.
143
-
3. Enter *Images* for the name of the first path. Enter */images/*\* for the path. Select **imagesBackendPool** for the backend pool.
144
-
4. Enter *Video* for the name of the second path. Enter */video/*\* for the path. Select **videoBackendPool** for the backend pool.
139
+
4. On the **Backends** tab, select **Next: Configuration**.
145
140
146
-

141
+
### Configuration tab
142
+
143
+
On the **Configuration** tab, you'll connect the frontend and backend pool you created using a routing rule.
144
+
145
+
1. Select **Add a rule** in the **Routing rules** column.
146
+
147
+
2. In the **Add a routing rule** window that opens, enter *myRoutingRule* for the **Rule name**.
148
+
149
+
3. A routing rule requires a listener. On the **Listener** tab within the **Add a routing rule** window, enter the following values for the listener:
150
+
151
+
- **Listener name**: Enter *myListener* for the name of the listener.
152
+
- **Frontend IP**: Select **Public** to choose the public IP you created for the frontend.
153
+
- **Port**: Type *8080*
154
+
155
+
Accept the default values for the other settings on the **Listener** tab, then select the **Backend targets** tab to configure the rest of the routing rule.
156
+
157
+

158
+
159
+
4. On the **Backend targets** tab, select **myBackendPool** for the **Backend target**.
160
+
161
+
5. For the **HTTP setting**, select **Create new** to create a new HTTP setting. The HTTP setting will determine the behavior of the routing rule.
162
+
163
+
6. In the **Add an HTTP setting** window that opens, enter *myHTTPSetting* for the **HTTP setting name**. Accept the default values for the other settings in the **Add an HTTP setting** window, then select **Add** to return to the **Add a routing rule** window.
164
+
165
+

166
+
167
+
7. Under **Path-based routing**, select **Add multiple targets to create a path-based rule**.
168
+
8. For **Path**, type */images/*\*.
169
+
9. For **Path rule name**, type *Images*.
170
+
10. For **HTTP setting**, select **myHTTPSetting**
171
+
11. For **Backend target**, select **Images**.
172
+
12. Select **Add** to save the path rule and return to the **Add a routing rule** tab.
173
+
13. Repeat to add a another rule for Video.
174
+
14. Select **Add** to add the routing rule and return to the **Configuration** tab.
175
+
15. Select **Next: Tags** and then **Next: Review + create**.
176
+
177
+
> [!NOTE]
178
+
> You do not need to add a custom */** path rule to handle default cases. This is automatically handled by the default backend pool.
179
+
180
+
### Review + create tab
181
+
182
+
Review the settings on the **Review + create** tab, and then select **Create** to create the virtual network, the public IP address, and the application gateway. It may take several minutes for Azure to create the application gateway. Wait until the deployment finishes successfully before moving on to the next section.
147
183
148
-
5. Click **OK**.
149
184
150
185
## Test the application gateway
151
186
152
-
1. Click **All resources**, and then click **myAGPublicIPAddress**.
187
+
1. Select **All resources**, and then select **myAppGateway**.
153
188
154
189

155
190
156
-
2. Copy the public IP address, and then paste it into the address bar of your browser. Such as, http:\//40.121.222.19.
191
+
2. Copy the public IP address, and then paste it into the address bar of your browser. Such as, http:\//52.188.72.175:8080.
157
192
158
193

159
194
160
-
3. Change the URL to http://<ip-address>:8080/images/test.htm, substituting <ip-address> with your IP address, and you should see something like the following example:
195
+
The listener on port 8080 routes this request to the default backend pool.
196
+
197
+
3. Change the URL to *http://<ip-address>:8080/images/test.htm*, substituting <ip-address> with your IP address, and you should see something like the following example:
161
198
162
199

163
200
164
-
4. Change the URL to http://<ip-address>:8080/video/test.htm, substituting <ip-address> with your IP address, and you should see something like the following example:
201
+
The listener on port 8080 routes this request to the *Images* backend pool.
202
+
203
+
4. Change the URL to *http://<ip-address>:8080/video/test.htm*, substituting <ip-address> with your IP address, and you should see something like the following example:
165
204
166
205

167
206
168
-
## Next steps
207
+
The listener on port 8080 routes this request to the *Video* backend pool.
169
208
170
-
In this article, you learned how to
171
209
172
-
> [!div class="checklist"]
173
-
> * Create an application gateway
174
-
> * Create virtual machines for backend servers
175
-
> * Create backend pools with the backend servers
176
-
> * Create a backend listener
177
-
> * Create a path-based routing rule
210
+
## Next steps
178
211
179
-
To learn more about application gateways and their associated resources, continue to the how-to articles.
212
+
- [Enabling end to end SSL on Azure Application Gateway](application-gateway-backend-ssl.md)
0 commit comments