Skip to content

Commit d7ac98c

Browse files
Merge pull request #239368 from mbrat2005/vmss-appgw-add
VMSS Add AppGW Docs Update
2 parents e1fddd9 + 6869565 commit d7ac98c

File tree

1 file changed

+77
-2
lines changed

1 file changed

+77
-2
lines changed

articles/virtual-machine-scale-sets/virtual-machine-scale-sets-networking.md

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,76 @@ Azure Accelerated Networking improves network performance by enabling single roo
4040
## Azure Virtual Machine Scale Sets with Azure Load Balancer
4141
See [Azure Load Balancer and Virtual Machine Scale Sets](../load-balancer/load-balancer-standard-virtual-machine-scale-sets.md) to learn more about how to configure your Standard Load Balancer with Virtual Machine Scale Sets based on your scenario.
4242

43-
## Create a scale set that references an Application Gateway
44-
To create a scale set that uses an application gateway, reference the backend address pool of the application gateway in the ipConfigurations section of your scale set as in this ARM template config:
43+
## Add a Virtual Machine Scale Set to an Application Gateway
44+
45+
To add a scale set to the backend pool of an Application Gateway, reference the Application Gateway backend pool in your scale set's network profile. This can be done either when creating the scale set (see ARM Template below) or on an existing scale set.
46+
47+
### Adding Uniform Orchestration Virtual Machine Scale Sets to an Application Gateway
48+
49+
When adding Uniform Virtual Machine Scale Sets to an Application Gateway's backend pool, the process will differ for new or existing scale sets:
50+
51+
- For new scale sets, reference the Application Gateway's backend pool ID in your scale set model's network profile, under one or more network interface IP configurations. When deployed, instances added to your scale set will be placed in the Application Gateway's backend pool.
52+
- For existing scale sets, first add the Application Gateway's backend pool ID in your scale set model's network profile, then apply the model your existing instances by an upgrade. If the scale set's upgrade policy is `Automatic` or `Rolling`, instances will be updated for you. If it is `Manual`, you need to upgrade the instances manually.
53+
54+
#### [Portal](#tab/portal1)
55+
56+
1. Create an Application Gateway and backend pool in the same region as your scale set, if you do not already have one
57+
1. Navigate to the Virtual Machine Scale Set in the Portal
58+
1. Under **Settings**, open the **Networking** pane
59+
1. In the Networking pane, select the **Load balancing** tab and click **Add Load Balancing**
60+
1. Select **Application Gateway** from the Load Balancing Options dropdown, and choose an existing Application Gateway
61+
1. Select the target backend pool and click **Save**
62+
1. If your scale set Upgrade Policy is 'Manual', navigate to the **Settings** > **Instances** pane to select and upgrade each of your instances
63+
64+
#### [PowerShell](#tab/powershell1)
65+
66+
```azurepowershell
67+
$appGW = Get-AzApplicationGateway -Name <appGWName> -ResourceGroup <AppGWResourceGroupName>
68+
$backendPool = Get-AzApplicationGatewayBackendAddressPool -Name <backendAddressPoolName> -ApplicationGateway $appGW
69+
$vmss = Get-AzVMSS -Name <VMSSName> -ResourceGroup <VMSSResourceGroupName>
70+
71+
$backendPoolMembership = New-Object System.Collections.Generic.List[Microsoft.Azure.Management.Compute.Models.SubResource]
72+
73+
# add existing backend pool membership to new pool membership of first NIC and ip config
74+
If ($vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].IpConfigurations[0].ApplicationGatewayBackendAddressPools) {
75+
$backendPoolMembership.AddRange($vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].IpConfigurations[0].ApplicationGatewayBackendAddressPools)
76+
}
77+
78+
# add new backend pool to pool membership
79+
$backendPoolMembership.Add($backendPool.id)
80+
81+
# set VMSS model to use to backend pool membership
82+
$vmss.VirtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].IpConfigurations[0].ApplicationGatewayBackendAddressPools = $backendPoolMembership
83+
84+
# update the VMSS model
85+
$vmss | Update-AzVMSS
86+
87+
# update VMSS instances, if necessary
88+
If ($vmss.UpgradePolicy.Mode -eq 'Manual') {
89+
$vmss | Get-AzVmssVM | Foreach-Object { $_ | Update-AzVMSSInstance -InstanceId $_.instanceId}
90+
}
91+
92+
```
93+
94+
#### [CLI](#tab/cli1)
95+
96+
```azurecli-interactive
97+
appGWName=<appGwName>
98+
appGWResourceGroup=<appGWRGName>
99+
backendPoolName=<backendPoolName>
100+
backendPoolId=$(az network application-gateway address-pool show --gateway-name $appGWName -g $appGWResourceGroup -n $backendPoolName --query id -otsv)
101+
102+
vmssName=<vmssName>
103+
vmssResourceGroup=<vmssRGName>
104+
105+
# add app gw backend pool to first nic's first ip config
106+
az vmss update -n $vmssName -g $vmssResourceGroup --add "virtualMachineProfile.NetworkProfile.NetworkInterfaceConfigurations[0].ipConfigurations[0].applicationGatewayBackendAddressPools" "id=$backendPoolId"
107+
108+
# update instances
109+
az vmss update-instances --instance-ids * --name $vmssName --resource-group $vmssResourceGroup
110+
```
111+
112+
#### [ARM template](#tab/arm1)
45113

46114
```json
47115
"ipConfigurations": [{
@@ -56,6 +124,13 @@ To create a scale set that uses an application gateway, reference the backend ad
56124
}]
57125
```
58126

127+
---
128+
<!-- The three dashes above show that your section of tabbed content is complete. Don't remove them :) -->
129+
130+
### Adding Flexible Orchestration Virtual Machine Scale Sets to an Application Gateway
131+
132+
When adding a Flexible scale set to an Application Gateway, the process is the same as adding standalone VMs to an Application Gateway's backend pool--you update the virtual machine's network interface IP configuration to be part of the backend pool. This can be done either [through the Application Gateway's configuration](/azure/application-gateway/create-multiple-sites-portal#add-backend-servers-to-backend-pools) or by configuring the virtual machine's network interface configuration.
133+
59134
>[!NOTE]
60135
> Note that the application gateway must be in the same virtual network as the scale set but must be in a different subnet from the scale set.
61136

0 commit comments

Comments
 (0)