Lab 06
Lab 06
Lab scenario
You were tasked with testing managing network traffic targeting Azure virtual
machines in the hub and spoke network topology, which Trinity considers
implementing in its Azure environment (instead of creating the mesh topology, which
you tested in the previous lab). This testing needs to include implementing
connectivity between spokes by relying on user defined routes that force traffic to flow
via the hub, as well as traffic distribution across virtual machines by using layer 4 and
layer 7 load balancers. For this purpose, you intend to use Azure Load Balancer (layer
4) and Azure Application Gateway (layer 7).
Note: This lab, by default, requires total of 8 vCPUs available in the Standard_Dsv3 series in the region
you choose for deployment, since it involves deployment of four Azure VMs of Standard_D2s_v3 SKU.
If your students are using trial accounts, with the limit of 4 vCPUs, you can use a VM size that requires
only one vCPU (such as Standard_B1s).
Objectives
In this lab, you will:
Instructions
Exercise 1
2. In the Azure portal, open the Azure Cloud Shell by clicking on the icon in the
top right of the Azure Portal.
Note: If this is the first time you are starting Cloud Shell and you are presented with the You have no
storage mounted message, select the subscription you are using in this lab, and click Create storage.
4. In the toolbar of the Cloud Shell pane, click the Upload/Download files icon,
in the drop-down menu, click Upload and upload the files az104-06-vms-
loop-template.json and az104-06-vms-loop-parameters.json into the
Cloud Shell home directory.
5. From the Cloud Shell pane, run the following to create the first resource group
that will be hosting the lab environment (replace the ‘[Azure_region]’
placeholder with the name of an Azure region where you intend to deploy Azure
virtual machines) (you can use the “(Get-AzLocation).Location” cmdlet to get
the region list):
$location = '[Azure_region]'
$rgName = 'az104-06-rg1'
6. From the Cloud Shell pane, run the following to create the three virtual networks
and four Azure VMs into them by using the template and parameter files you
uploaded:
New-AzResourceGroupDeployment `
-ResourceGroupName $rgName `
-TemplateFile $HOME/az104-06-vms-loop-template.json `
-TemplateParameterFile $HOME/az104-06-vms-loop-parameters.json
Note: Wait for the deployment to complete before proceeding to the next step. This should
take about 5 minutes.
Note: If you got an error stating the VM size is not available please ask your instructor for
assistance and try these steps.
b. Check the location in which the ‘az104-06-rg1’ resource group is deployed. You can run az
group show -n az104-06-rg1 --query location in your CloudShell to get it.
d. Replace the value of vmSize parameter with one of the values returned by the command
you just run. If there are no values returned, you may need to choose a different region to
deploy into. You may also choose a different family name, like “Standard_B1s”.
7. From the Cloud Shell pane, run the following to install the Network Watcher
extension on the Azure VMs deployed in the previous step:
$rgName = 'az104-06-rg1'
$location = (Get-AzResourceGroup -ResourceGroupName $rgName).location
$vmNames = (Get-AzVM -ResourceGroupName $rgName).Name
Note: Wait for the deployment to complete before proceeding to the next step. This should take about
5 minutes.
Note: The template you used for deployment of the three virtual networks ensures that the IP address
ranges of the three virtual networks do not overlap.
Note: You will need the values of the ResourceID property for both virtual networks later in this task.
Note: This is a workaround that addresses the issue with the Azure portal occasionally not displaying
the newly provisioned virtual network when creating virtual network peerings.
11. Add a peering with the following settings (leave others with their default values)
and click Add:
Setting Value
13. Add a peering with the following settings (leave others with their default values)
and click Add:
Setting Value
Note: This step establishes two local peerings - one from az104-06-vnet01 to az104-06-vnet3 and the
other from az104-06-vnet3 to az104-06-vnet01. This completes setting up the hub and spoke topology
(with two spoke virtual networks).
Task 3: Test transitivity of virtual network peering
In this task, you will test transitivity of virtual network peering by using Network
Watcher.
2. On the Network Watcher blade, expand the listing of Azure regions and verify
the service is enabled in region you are using.
Note: It may take a few minutes for the resource group to be listed. If you don’t want to wait, try this:
delete the Network Watcher, create a new Network Watcher, and then retry Connection Troubleshoot.
Setting Value
Subscription the name of the Azure subscription you are using in this lab
Protocol TCP
Note: This is expected, since the hub virtual network is peered directly with the first spoke virtual
network.
Setting Value
Protocol TCP
7. Click Run diagnostic tests and wait until results of the connectivity check are
returned. Verify that the status is Success. Review the network path and note
that the connection was direct, with no intermediate hops in between the VMs.
Note: This is expected, since the hub virtual network is peered directly with the second spoke virtual
network.
Protocol TCP
9. Click Run diagnostic tests and wait until results of the connectivity check are
returned. Note that the status is Fail.
Note: This is expected, since the two spoke virtual networks are not peered with each other (virtual
network peering is not transitive).
2. On the Virtual machines blade, in the list of virtual machines, click az104-06-
vm0.
Note: This setting is required in order for az104-06-vm0 to function as a router, which will route traffic
between two spoke virtual networks.
Note: Now you need to configure operating system of the az104-06-vm0 virtual machine to support
routing.
6. In the Azure portal, navigate back to the az104-06-vm0 Azure virtual machine
blade and click Overview.
8. On the Run Command Script blade, type the following and click Run to install
the Remote Access Windows Server role.
Note: Wait for the confirmation that the command completed successfully.
9. On the Run Command Script blade, type the following and click Run to install
the Routing role service.
Note: Wait for the confirmation that the command completed successfully.
Note: Now you need to create and configure user defined routes on the spoke virtual networks.
10. In the Azure portal, search and select Route tables and, on the Route
tables blade, click + Create.
11. Create a route table with the following settings (leave others with their default
values):
Setting Value
Subscription the name of the Azure subscription you are using in this lab
Location the name of the Azure region in which you created the virtual
networks
Name az104-06-rt23
Propagate gateway No
routes
12. Click Review and Create. Let validation occur, and click Create to submit your
deployment.
Note: Wait for the route table to be created. This should take about 3 minutes.
14. On the az104-06-rt23 route table blade, in the Settings section, click Routes,
and then click + Add.
Setting Value
17. Back on the az104-06-rt23 route table blade, in the Settings section,
click Subnets, and then click + Associate.
18. Associate the route table az104-06-rt23 with the following subnet:
Setting Value
Subnet subnet0
21. Create a route table with the following settings (leave others with their default
values):
Setting Value
Subscription the name of the Azure subscription you are using in this lab
Region the name of the Azure region in which you created the virtual
networks
Name az104-06-rt32
Propagate gateway No
routes
22. Click Review and Create. Let validation occur, and hit Create to submit your
deployment.
Note: Wait for the route table to be created. This should take about 3 minutes.
Setting Value
26. Click OK
27. Back on the az104-06-rt32 route table blade, in the Settings section,
click Subnets, and then click + Associate.
28. Associate the route table az104-06-rt32 with the following subnet:
Setting Value
Subnet subnet0
29. Click OK
30. In the Azure portal, navigate back to the Network Watcher - Connection
troubleshoot blade.
31. On the Network Watcher - Connection troubleshoot blade, use the following
settings (leave others with their default values):
Setting Value
Subscription the name of the Azure subscription you are using in this
lab
Protocol TCP
32. Click Run diagnostic tests and wait until results of the connectivity check are
returned. Verify that the status is Success. Review the network path and note
that the traffic was routed via 10.60.0.4, assigned to the az104-06-
nic0 network adapter. If status is Fail, you should stop and then start az104-06-
vm0.
Note: This is expected, since the traffic between spoke virtual networks is now routed via the virtual
machine located in the hub virtual network, which functions as a router.
Note: You can use Network Watcher to view topology of the network.
1. In the Azure portal, search for and select Load balancers and, on the Load
balancers blade, click + Create.
2. Create a load balancer with the following settings (leave others with their
default values) then click Next: Frontend IP configuration:
Setting Value
Subscription the name of the Azure subscription you are using in this lab
Name az104-06-lb4
Region name of the Azure region into which you deployed all other
resources in this lab
SKU Standard
Type Public
Tier Regional
Setting Value
Name az104-06-fe4
IP type IP address
4. On the Add a public IP address popup, use the following settings before
clicking OK and then Add. When completed click Next: Backend pools.
Setting Value
Name az104-06-pip4
SKU Standard
Tier Regional
Assignment Static
5. On the Backend pools tab, click Add a backend pool with the following
settings (leave others with their default values). Click + Add (twice) and then
click Next: Inbound rules.
Setting Value
Name az104-06-lb4-be1
IP Version IPv4
6. On the Inbound rules tab, click Add a load balancing rule. Add a load
balancing rule with the following settings (leave others with their default
values). When completed click Add.
Setting Value
Name az104-06-lb4-
lbrule1
IP Version IPv4
Protocol TCP
Port 80
Backend port 80
Name az104-06-lb4-hp1
Protocol TCP
Port 80
Interval 5
Floating IP Disabled
9. Select Frontend IP configuration from the Load Balancer resource page. Copy
the IP address.
10. Open another browser tab and navigate to the IP address. Verify that the
browser window displays the message Hello World from az104-06-
vm0 or Hello World from az104-06-vm1.
11. Refresh the window to verify the message changes to the other virtual machine.
This demonstrates the load balancer rotating through the virtual machines.
Note: You may need to refresh more than once or open a new browser window in InPrivate mode.
2. On the Virtual networks blade, in the list of virtual networks, click az104-06-
vnet01.
4. Add a subnet with the following settings (leave others with their default values):
Setting Value
Name subnet-appgw
Note: This subnet will be used by the Azure Application Gateway instances, which you will deploy later
in this task. The Application Gateway requires a dedicated subnet of /27 or larger size.
7. On the Basics tab, specify the following settings (leave others with their default
values)
Setting Value
Subscription the name of the Azure subscription you are using in this lab
Region name of the Azure region into which you deployed all other
resources in this lab
Tier Standard V2
Enable autoscaling No
Instance count 2
HTTP2 Disabled
8. Click Next: Frontends > and specify the following settings (leave others with
their default values). When complete, click OK.
Setting Value
Name az104-06-pip5
9. Click Next: Backends > and then Add a backend pool. Specify the following
settings (leave others with their default values). When completed click Add.
Setting Value
Name az104-06-appgw5-be1
Note: The targets represent the private IP addresses of virtual machines in the spoke virtual
networks az104-06-vm2 and az104-06-vm3.
10. Click Next: Configuration > and then + Add a routing rule. Specify the
following settings:
Setting Value
Priority 10
Frontend IP Public
Protocol HTTP
Port 80
11. Switch to the Backend targets tab and specify the following settings (leave
others with their default values). When completed click Add (twice).
Setting Value
Backend port 80
Note: Wait for the Application Gateway instance to be created. This might take about 8 minutes.
13. In the Azure portal, search and select Application Gateways and, on
the Application Gateways blade, click az104-06-appgw5.
15. Start another browser window and navigate to the IP address you identified in
the previous step.
16. Verify that the browser window displays the message Hello World from
az104-06-vm2 or Hello World from az104-06-vm3.
17. Refresh the window to verify the message changes to the other virtual machine.
Note: You may need to refresh more than once or open a new browser window in InPrivate mode.
Note: Targeting virtual machines on multiple virtual networks is not a common configuration, but it is
meant to illustrate the point that Application Gateway is capable of targeting virtual machines on
multiple virtual networks (as well as endpoints in other Azure regions or even outside of Azure), unlike
Azure Load Balancer, which load balances across virtual machines in the same virtual network.
Clean up resources
Note: Remember to remove any newly created Azure resources that you no longer use. Removing
unused resources ensures you will not see unexpected charges.
Note: Don’t worry if the lab resources cannot be immediately removed. Sometimes resources have
dependencies and take a longer time to delete. It is a common Administrator task to monitor resource
usage, so just periodically review your resources in the Portal to see how the cleanup is going.
1. In the Azure portal, open the PowerShell session within the Cloud Shell pane.
2. List all resource groups created throughout the labs of this module by running
the following command:
Note: The command executes asynchronously (as determined by the -AsJob parameter), so while you
will be able to run another PowerShell command immediately afterwards within the same PowerShell
session, it will take a few minutes before the resource groups are actually removed.
Review
In this lab, you have:
***