- Lab
- A Cloud Guru
Implement an Azure Application Gateway
In this hands-on lab, you are working as an Azure network engineer for The Root, a company that sells plants and flowers online. You’ve been asked to create an Azure Application Gateway as a frontend for two of their web servers that are hosted on virtual machines. You’ll use Azure Application Gateway to provide connectivity to two virtual machines through three different implementation styles, including basic round-robin, multi-site, and routing via URL.
Path Info
Table of Contents
-
Challenge
Create an Application Gateway and Test Basic Functionality
-
Create an Application Gateway with the following parameters (leaving anything not specifically noted at the default setting):
- Basics
- For Application gateway name, provide a unique name
- Set Region to the same region as the VNet
- Set Tier to Standard V2
- Set Enable autoscaling to No
- Set Instance count to 1
- Select the existing Virtual network that has been provisioned
- Set Subnet to appgateway-subnet (selected automatically, based on the virtual network)
- Frontends
- Set Frontend IP address type to Public
- For Public IP address, add new public IP address and, for its Name, provide a unique name
- Backends
- Add a backend pool
- For Name, provide a unique name
- For Backend targets, select the existing VMs as targets:
- Set Target type to Virtual machine and set Target to the existing vm1 VM
- Set Target type to Virtual machine and set Target to the existing vm2 VM
- Add a backend pool
- Configuration
- Routing rules > Add a routing rule
- For Rule name, provide a unique name
- Set Priority to 1
- Listener
- For Listener name, provide a unique name
- Set Frontend IP to Public
- Set Protocol to HTTP
- Set Port to 80
- Set Listener type to Basic
- Backend targets
- Set Target type to Backend pool
- Set Backend target to the existing backend pool of VMs
- For Backend settings, select Add new and set the following:
- For Backend settings name, provide a unique name
- Set Backend protocol to HTTP
- Set Backend port to 80
- Routing rules > Add a routing rule
- Basics
-
Once the Application Gateway has been deployed, connect to it in your browser via its public IP address.
- You will be connected to either the
vm1
orvm2
VM in the Application Gateway, with traffic balanced between the two VMs in the backend pool.
- You will be connected to either the
-
-
Challenge
Reconfigure the Application Gateway for Multi-Site Hosting
-
Create two new Backend pools, one for each VM, in the Application Gateway.
- E.g., vm1bepool that contains vm1
- E.g., vm2bepool that contains vm2
-
Add two new Listeners (e.g., vm1listener and vm2listener) to the Application Gateway.
- Set Frontend IP to Public
- Set Protocol to HTTP
- Set Port to a unique port number to avoid conflict with the other listener
- E.g., port 8080 and 8081, respectively
- Set Listener type to Multi site
- Set Host type to Single
- For Host name, provide a unique name
- For this lab, you can use something like vm1.theroot.com and vm2.theroot.com for the host name of each of the listeners
-
Create two new routing Rules, one for each VM, in the Application Gateway.
- Match your newly created listeners and backend pools to the new routing rules.
-
Test it!
- Connect to the
user-vm
via its public ip address and remote desktop using the credentials on the lab page. - Set the IE Enhanced Security Configuration option to Off for both Administrators and Users to disable the feature.
- Open up Notepad as an administrator.
- Open the file located at
C:\Windows\system32\drivers\etc\hosts
- Copy and paste in the public IP address of the Application Gateway and the host name of the VMs created in the listeners.
- E.g.,
20.237.221.2 vm1.theroot.com
- E.g.,
20.237.221.2 vm2.theroot.com
- E.g.,
- Save the file.
- Connect to the Application Gateway in Internet Explorer via each VM's host name and port.
- E.g.,
http://vm1.theroot.com:8080
- E.g.,
http://vm2.theroot.com:8081
- E.g.,
- You will be connected to the correct VM,
vm1
orvm2
, depending on the host name you entered.
- Connect to the
-
-
Challenge
Reconfigure the Application Gateway for Routing via URL
-
Delete the basic routing rule to free up the initial listener you created when you first deployed the Application Gateway.
-
Create a new routing rule that sends traffic to
vm1
's backend pool.- For Listener, choose the original listener created at the beginning of lab
- For the Backend targets settings:
- Set Backend target to the backend pool you created for vm1 (e.g., vm1bepool)
- Set Backend settings to your default HTTP settings
- For Path-based routing, click Add multiple targets to create a path-based rule and set the following:
- Set Path to /images/*
- Set Target name to vm2
- Set Backend settings to your default HTTP settings
- Set Backend target to the backend pool you created for vm2 (e.g., vm2bepool)
-
Test it!
- Connect to the Application Gateway in your browser via its public IP address.
- You will be connected to the
vm1
VM, no matter how many times you refresh the page.
- You will be connected to the
- Connect to the Application Gateway's
/images/
directory in your browser via its public IP address.- E.g.,
20.237.221.2/images/
- You will be connected to the
/images/
directory on thevm2
VM.
- E.g.,
- Connect to the Application Gateway in your browser via its public IP address.
-
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.