-1

Is it possible to deploy a scale set that can receive traffic from internet (via Application gateway) and also from internal servers (vi azure loadbalancer).

Please see image for clarification

Thanks

Zak
  • 13
  • 3

1 Answers1

1

You most certainly can! Here's some sample code using the Azure CLI:

# create an Azure Load Balancer that is associated to a virtual network
# instead of a public IP:
$ az network lb create -g multirg -n privatealb --vnet-name vnet --subnet scalesetsubnet

# create an application gateway:
$ az network application-gateway create -g multirg -n appgw --vnet-name vnet --subnet appgwsubnet

# create a scale set associated with the app gateway (note: 'az vmss create'
# does not allow specifying multiple load balancers; we'll just create with
# the app gateway for now and add the Azure Load Balancers afterwards)
$ az vmss create -g multirg -n scaleset --app-gateway appgw --image UbuntuLTS --generate-ssh-keys --vnet-name vnet --subnet scalesetsubnet --upgrade-policy Automatic

# to associate the scale set with the load balancer post-creation,
# we will need to know the resource IDs of the load balancer's backend
# pool; we can get this using the 'az network lb show' command:
$ az network lb show -g multirg -n privatealb
{
 "backendAddressPools": [
 {
.
.
.
 "id": "{private-alb-pool-id}",
.
.
.
}

# we can then use the 'az vmss update' command to associate the Azure
# Load Balancer with the scale set:
az vmss update --resource-group multirg --name scaleset --add virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].LoadBalancerBackendAddressPools '{"id": "{private-alb-pool-id}"}'

I also wrote up a quick blog post describing scale set + Azure Load Balancer + App Gateway scenarios. For more info, find it here: https://negatblog.wordpress.com/2018/06/21/scale-sets-and-load-balancers/

Hope this helps! :) -Neil

Neil Sant Gat
  • 857
  • 6
  • 10