Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a9745ea

Browse files
committedApr 19, 2018
mvc-05
1 parent d17cdcd commit a9745ea

File tree

10 files changed

+307
-0
lines changed

10 files changed

+307
-0
lines changed
 
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Enabling end to end SSL on Azure Application Gateway | Microsoft Docs
3+
description: This page provides an overview of the Application Gateway end to end SSL support.
4+
documentationcenter: na
5+
services: application-gateway
6+
author: amsriva
7+
manager: rossort
8+
editor: amsriva
9+
10+
ms.assetid: 3976399b-25ad-45eb-8eb3-fdb736a598c5
11+
ms.service: application-gateway
12+
ms.devlang: na
13+
ms.topic: hero-article
14+
ms.tgt_pltfrm: na
15+
ms.custom: H1Hack27Feb2017
16+
ms.workload: infrastructure-services
17+
ms.date: 07/19/2017
18+
ms.author: amsriva
19+
20+
---
21+
# Overview of end to end SSL with Application Gateway
22+
23+
Application gateway supports SSL termination at the gateway, after which traffic typically flows unencrypted to the backend servers. This feature allows web servers to be unburdened from costly encryption and decryption overhead. However for some customers unencrypted communication to the backend servers is not an acceptable option. This unencrypted communication could be due to security requirements, compliance requirements, or the application may only accept a secure connection. For such applications, application gateway supports end to end SSL encryption.
24+
25+
## Overview
26+
27+
End to end SSL allows you to securely transmit sensitive data to the backend encrypted while still taking advantage of the benefits of Layer 7 load balancing features which application gateway provides. Some of these features are cookie-based session affinity, URL-based routing, support for routing based on sites, or ability to inject X-Forwarded-* headers.
28+
29+
When configured with end to end SSL communication mode, application gateway terminates the SSL sessions at the gateway and decrypts user traffic. It then applies the configured rules to select an appropriate backend pool instance to route traffic to. Application gateway then initiates a new SSL connection to the backend server and re-encrypts data using the backend server's public key certificate before transmitting the request to the backend. End to end SSL is enabled by setting protocol setting in BackendHTTPSetting to HTTPS, which is then applied to a backend pool. Each backend server in the backend pool with end to end SSL enabled must be configured with a certificate to allow secure communication.
30+
31+
![end to end ssl scenario][1]
32+
33+
In this example, requests using TLS1.2 are routed to backend servers in Pool1 using end to end SSL.
34+
35+
## End to end SSL and whitelisting of certificates
36+
37+
Application gateway only communicates with known backend instances that have whitelisted their certificate with the application gateway. To enable whitelisting of certificates, you must upload the public key of backend server certificates to the application gateway (not the root certificate). Only connections to known and whitelisted backends are then allowed. The remaining backends results in a gateway error. Self-signed certificates are for test purposes only and not recommended for production workloads. Such certificates have to be whitelisted with the application gateway as described in the preceding steps before they can be used.
38+
39+
## Next steps
40+
41+
After learning about end to end SSL, go to [enable end to end SSL on application gateway](tutorial-ssl-powershell.md) to create an application gateway using end to end SSL.
42+
43+
<!--Image references-->
44+
45+
[1]: ./media/ssl-overview/scenario.png
Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
---
2+
title: Create an application gateway that hosts multiple web sites - Azure CLI
3+
description: Learn how to create an application gateway that hosts multiple web sites using the Azure CLI.
4+
services: application-gateway
5+
author: vhorne
6+
manager: jpconnock
7+
8+
ms.service: application-gateway
9+
ms.topic: tutorial
10+
ms.workload: infrastructure-services
11+
ms.date: 3/22/2018
12+
ms.author: victorh
13+
ms.custom: mvc
14+
#Customer intent: As an IT administrator, I want to use Azure CLI to configure Application Gateway to host multiple web sites , so I can ensure my customers can acess the web information they need.
15+
---
16+
# Tutorial: Create an application gateway that hosts multiple web sites using the Azure CLI
17+
18+
You can use the Azure CLI to [configure the hosting of multiple web sites](multiple-site-overview.md) when you create an [application gateway](overview.md). In this tutorial, you define backend address pools using virtual machines scale sets. You then configure listeners and rules based on domains that you own to make sure web traffic arrives at the appropriate servers in the pools. This tutorial assumes that you own multiple domains and uses examples of *www.contoso.com* and *www.fabrikam.com*.
19+
20+
In this tutorial, you learn how to:
21+
22+
> [!div class="checklist"]
23+
> * Set up the network
24+
> * Create an application gateway
25+
> * Create backend listeners
26+
> * Create routing rules
27+
> * Create virtual machine scale sets with the backend pools
28+
> * Create a CNAME record in your domain
29+
30+
![Multi-site routing example](./media/tutorial-multiple-sites-cli/scenario.png)
31+
32+
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
33+
34+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
35+
36+
If you choose to install and use the CLI locally, this quickstart requires that you are running the Azure CLI version 2.0.4 or later. To find the version, run `az --version`. If you need to install or upgrade, see [Install Azure CLI 2.0](/cli/azure/install-azure-cli).
37+
38+
## Create a resource group
39+
40+
A resource group is a logical container into which Azure resources are deployed and managed. Create a resource group using [az group create](/cli/azure/group#create).
41+
42+
The following example creates a resource group named *myResourceGroupAG* in the *eastus* location.
43+
44+
```azurecli-interactive
45+
az group create --name myResourceGroupAG --location eastus
46+
```
47+
48+
## Create network resources
49+
50+
Create the virtual network and the subnet named *myAGSubnet* using [az network vnet create](/cli/azure/network/vnet#az_net). You can then add the subnet that's needed by the backend servers using [az network vnet subnet create](/cli/azure/network/vnet/subnet#az_network_vnet_subnet_create). Create the public IP address named *myAGPublicIPAddress* using [az network public-ip create](/cli/azure/public-ip#az_network_public_ip_create).
51+
52+
```azurecli-interactive
53+
az network vnet create \
54+
--name myVNet \
55+
--resource-group myResourceGroupAG \
56+
--location eastus \
57+
--address-prefix 10.0.0.0/16 \
58+
--subnet-name myAGSubnet \
59+
--subnet-prefix 10.0.1.0/24
60+
61+
az network vnet subnet create \
62+
--name myBackendSubnet \
63+
--resource-group myResourceGroupAG \
64+
--vnet-name myVNet \
65+
--address-prefix 10.0.2.0/24
66+
67+
az network public-ip create \
68+
--resource-group myResourceGroupAG \
69+
--name myAGPublicIPAddress
70+
```
71+
72+
## Create the application gateway
73+
74+
You can use [az network application-gateway create](/cli/azure/application-gateway#create) to create the application gateway. When you create an application gateway using the Azure CLI, you specify configuration information, such as capacity, sku, and HTTP settings. The application gateway is assigned to *myAGSubnet* and *myAGPublicIPAddress* that you previously created.
75+
76+
```azurecli-interactive
77+
az network application-gateway create \
78+
--name myAppGateway \
79+
--location eastus \
80+
--resource-group myResourceGroupAG \
81+
--vnet-name myVNet \
82+
--subnet myAGsubnet \
83+
--capacity 2 \
84+
--sku Standard_Medium \
85+
--http-settings-cookie-based-affinity Disabled \
86+
--frontend-port 80 \
87+
--http-settings-port 80 \
88+
--http-settings-protocol Http \
89+
--public-ip-address myAGPublicIPAddress
90+
```
91+
92+
It may take several minutes for the application gateway to be created. After the application gateway is created, you can see these new features of it:
93+
94+
- *appGatewayBackendPool* - An application gateway must have at least one backend address pool.
95+
- *appGatewayBackendHttpSettings* - Specifies that port 80 and an HTTP protocol is used for communication.
96+
- *appGatewayHttpListener* - The default listener associated with *appGatewayBackendPool*.
97+
- *appGatewayFrontendIP* - Assigns *myAGPublicIPAddress* to *appGatewayHttpListener*.
98+
- *rule1* - The default routing rule that is associated with *appGatewayHttpListener*.
99+
100+
### Add the backend pools
101+
102+
Add the backend pools that are needed to contain the backend servers using [az network application-gateway address-pool create](/cli/azure/application-gateway#az_network_application_gateway_address_pool_create).
103+
104+
```azurecli-interactive
105+
az network application-gateway address-pool create \
106+
--gateway-name myAppGateway \
107+
--resource-group myResourceGroupAG \
108+
--name contosoPool
109+
110+
az network application-gateway address-pool create \
111+
--gateway-name myAppGateway \
112+
--resource-group myResourceGroupAG \
113+
--name fabrikamPool
114+
```
115+
116+
### Add backend listeners
117+
118+
Add the backend listeners that are needed to route traffic using [az network application-gateway http-listener create](/cli/azure/application-gateway#az_network_application_gateway_http_listener_create).
119+
120+
```azurecli-interactive
121+
az network application-gateway http-listener create \
122+
--name contosoListener \
123+
--frontend-ip appGatewayFrontendIP \
124+
--frontend-port appGatewayFrontendPort \
125+
--resource-group myResourceGroupAG \
126+
--gateway-name myAppGateway \
127+
--host-name www.contoso.com
128+
129+
az network application-gateway http-listener create \
130+
--name fabrikamListener \
131+
--frontend-ip appGatewayFrontendIP \
132+
--frontend-port appGatewayFrontendPort \
133+
--resource-group myResourceGroupAG \
134+
--gateway-name myAppGateway \
135+
--host-name www.fabrikam.com
136+
```
137+
138+
### Add routing rules
139+
140+
Rules are processed in the order they are listed, and traffic is directed using the first rule that matches regardless of specificity. For example, if you have a rule using a basic listener and a rule using a multi-site listener both on the same port, the rule with the multi-site listener must be listed before the rule with the basic listener in order for the multi-site rule to function as expected.
141+
142+
In this example, you create two new rules and delete the default rule that was created when you created the application gateway. You can add the rule using [az network application-gateway rule create](/cli/azure/application-gateway#az_network_application_gateway_rule_create).
143+
144+
```azurecli-interactive
145+
az network application-gateway rule create \
146+
--gateway-name myAppGateway \
147+
--name contosoRule \
148+
--resource-group myResourceGroupAG \
149+
--http-listener contosoListener \
150+
--rule-type Basic \
151+
--address-pool contosoPool
152+
153+
az network application-gateway rule create \
154+
--gateway-name myAppGateway \
155+
--name fabrikamRule \
156+
--resource-group myResourceGroupAG \
157+
--http-listener fabrikamListener \
158+
--rule-type Basic \
159+
--address-pool fabrikamPool
160+
161+
az network application-gateway rule delete \
162+
--gateway-name myAppGateway \
163+
--name rule1 \
164+
--resource-group myResourceGroupAG
165+
```
166+
167+
## Create virtual machine scale sets
168+
169+
In this example, you create three virtual machine scale sets that support the three backend pools in the application gateway. The scale sets that you create are named *myvmss1*, *myvmss2*, and *myvmss3*. Each scale set contains two virtual machine instances on which you install IIS.
170+
171+
```azurecli-interactive
172+
for i in `seq 1 2`; do
173+
174+
if [ $i -eq 1 ]
175+
then
176+
poolName="contosoPool"
177+
fi
178+
179+
if [ $i -eq 2 ]
180+
then
181+
poolName="fabrikamPool"
182+
fi
183+
184+
az vmss create \
185+
--name myvmss$i \
186+
--resource-group myResourceGroupAG \
187+
--image UbuntuLTS \
188+
--admin-username azureuser \
189+
--admin-password Azure123456! \
190+
--instance-count 2 \
191+
--vnet-name myVNet \
192+
--subnet myBackendSubnet \
193+
--vm-sku Standard_DS2 \
194+
--upgrade-policy-mode Automatic \
195+
--app-gateway myAppGateway \
196+
--backend-pool-name $poolName
197+
done
198+
```
199+
200+
### Install NGINX
201+
202+
```azurecli-interactive
203+
for i in `seq 1 2`; do
204+
205+
az vmss extension set \
206+
--publisher Microsoft.Azure.Extensions \
207+
--version 2.0 \
208+
--name CustomScript \
209+
--resource-group myResourceGroupAG \
210+
--vmss-name myvmss$i \
211+
--settings '{ "fileUris": ["https://raw.githubusercontent.com/davidmu1/samplescripts/master/install_nginx.sh"],
212+
"commandToExecute": "./install_nginx.sh" }'
213+
214+
done
215+
```
216+
217+
## Create a CNAME record in your domain
218+
219+
After the application gateway is created with its public IP address, you can get the DNS address and use it to create a CNAME record in your domain. You can use [az network public-ip show](/cli/azure/network/public-ip#az_network_public_ip_show) to get the DNS address of the application gateway. Copy the *fqdn* value of the DNSSettings and use it as the value of the CNAME record that you create.
220+
221+
```azurecli-interactive
222+
az network public-ip show \
223+
--resource-group myResourceGroupAG \
224+
--name myAGPublicIPAddress \
225+
--query [dnsSettings.fqdn] \
226+
--output tsv
227+
```
228+
229+
The use of A-records is not recommended because the VIP may change when the application gateway is restarted.
230+
231+
## Test the application gateway
232+
233+
Enter your domain name into the address bar of your browser. Such as, http://www.contoso.com.
234+
235+
![Test contoso site in application gateway](./media/tutorial-multiple-sites-cli/application-gateway-nginxtest1.png)
236+
237+
Change the address to your other domain and you should see something like the following example:
238+
239+
![Test fabrikam site in application gateway](./media/tutorial-multiple-sites-cli/application-gateway-nginxtest2.png)
240+
241+
## Clean up resources
242+
243+
When no longer needed, remove the resource group, application gateway, and all related resources.
244+
245+
```azurecli-interactive
246+
az group delete --name myResourceGroupAG --location eastus
247+
```
248+
249+
## Next steps
250+
251+
In this tutorial, you learned how to:
252+
253+
> [!div class="checklist"]
254+
> * Set up the network
255+
> * Create an application gateway
256+
> * Create backend listeners
257+
> * Create routing rules
258+
> * Create virtual machine scale sets with the backend pools
259+
> * Create a CNAME record in your domain
260+
261+
> [!div class="nextstepaction"]
262+
> [Create an application gateway with URL path-based routing rules](./tutorial-url-route-cli.md)

0 commit comments

Comments
 (0)
Please sign in to comment.