You can read the part 1 of this series by clicking this link.
Open CloudShell. Switch it to PowerShell and run this command first.
$publicSettings = @{ “fileUris” = (,”https://raw.githubusercontent.com/Azure/azure-docs-powershell-samples/master/application-gateway/iis/appgatewayurl.ps1″); “commandToExecute” = “powershell -ExecutionPolicy Unrestricted -File appgatewayurl.ps1” }
Next up, run this command for VM1.
Do the same for VM2 and VM3.
Next, click on Create a resource –> Networking –> Application Gateway
Put the Application Gateway in the same resource group as earlier. Give it a name. Same location. Enable autoscaling and for minimum instances, choose 2. For the VNet, choose the one that you created. And in the subnet, choose AGSubnet. Click Next.
In the Frontends tab, choose the public IP and create a new one. Click Next.
On the next tab, click Add a backend pool.
Create a backend pool. In my case, it is ktBackendPool that has Virtual Machine as the target type and VM1 as the target.
Create another backend pool called Images that has the VM2 as target.
And a third backend pool called Video that has VM3 as the target.
Now you will see three backend pools like this. Click Next to go to the Configuration tab.
The configuration tab would look like this. Click Add a rule.
Give a name to your routing rule. Under the Listener section, give the listener a name. Choose Public as the FrontEnd IP and port 8080. Rest everything default.
Go to Backend targets tab. In the target type, choose Backend pool. In the backend target, choose ktBackendPool. For the HTTP setting, click create new.
Give your HTTP setting a name and select 80 as the backend port. Save changes and go back to routing rules.
Under path-based routing, click Add multiple targets to create a path-based rule.
Add a path rule for images like this. Save changes and go back to routing rules.
Do the same for path rule of Video.
Click Add to add the routing rule.
Click Next.
Click Review + Create. Once the validation gets successful, click create.
This is what the output would look like.
That is it. Go ahead and try for yourself Azure Application Gateway.