Understand the use of Hub and Spoke topology in Microsoft Azure to connect with on-premises network
Scenario:
In real business environments, A Head office of an organization and its Branch offices could be in the same city or may be in the different cities. Branch offices have their own functions too but for some of the main tasks they need to contact with their Head office. The same scenario is used in Hub and spoke topology where Hub works like a central point as Head office and spokes work as branch offices. In Microsoft Azure, Hub virtual network can be used as a connectivity point to on-premises networks. that can peer spoke virtual network with the Hub virtual network and in this way, we can also isolate the workloads.
Follow the steps to understand and configure the above discussed scenario in the Microsoft Azure portal.
- Create resource Group and virtual networks
- Peer virtual networks with each other
- Verify connectivity - Ping from Hub-VM to Spoke VMs and vice versa
- Deployment of Virtual Network Gateway on Hub-VM
- Generate certificates on an on-premises network machine
- Install it on an on-premises machine
- Upload Certificate on Azure portal during the creation of VPN
- Connect on-premises machine to Azure through VPN
- Ping between Azure Hub-VM and on-premises machine to test the connectivity
![]() |
virtual networks for hub and spoke |
- Hub-VM for Hub-Vnet as Hub-VM
- Spoke1-VM for Spoke1-Vnet
- Spoke2-VM for Spoke2-Vnet
![]() |
virtual machine |
Step-3 Set the static IP of all three Virtual machines:
- 10.0.0.4 of Hub-VM
- 10.1.0.4 of Spoke1-VM
- 10.2.0.4 of Spoke2-VM
![]() |
IP setting for hub VM |
![]() |
IP setting for Spoke1-VM |
![]() |
IP setting for spoke-2 VM |
Step-4 Create peering between Hub and Spokes:
- Hub-Vnet and Spoke1-Vnet
- Hub-Vnet and Spoke2-Vnet
![]() |
Peering between Hub and Spoke1 |
![]() |
Peering between Hub and Spoke2 |
Step-5: Test the connectivity between Hub and Spoke VMs:
- Ping Hub-VM to Spoke1-VM
- Ping Hub-VM to Spoke2-VM
- Ping Spoke1-VM to Hub-VM
- Ping Spoke2-VM to Hub-VM
![]() |
Ping result Hub VM to Spoke1 and Spoke2 VMs |
![]() |
Ping result in Spoke1-VM to Hub-VM |
![]() |
Ping result in Spoke2-VM to Hub-VM |
Step-6: Create a Virtual Network Gateway and associate it with Hub-Vnet
![]() |
Virtual Network Gateway |
Step-7: Connectivity between Hub and on-premises network
- Install a VPN Client on an on-premises network machine and then connect it to your Azure account by using the command “Connect-AzAccount”
- To make the connection secure and for authentication of on-premises machine generate Root and Client Certificates on an on-premises machine.
![]() |
Root and Client Certificate |
![]() |
VPN and Root certificate in Azure portal |
To connect the on-premises network machine with Azure hub, run VPN client software installed earlier on an on-premises machine and connect with the VPN on the Azure portal.