Create hub and spoke virtual networks and subnets
Published: 2024-07-12 18:00:02

1. Open a browser and navigate to the Azure portal and login.

2. To create a Virtual Network, in the search bar at the top of the 
   portal type “Virtual Networks” and select “Virtual Networks” from 
   the results.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqi048tacs34nhf6eg1q.png)

3. In the “Virtual Networks” portal pane, select ““+ Create”

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yhwilieoar6zmhs5gyif.png) 

4. Click on "create new" to create a "resource group", give your resource group a name "RG1" and click "OK" to create the resource group. 

5. To create the "Virtual Network", select the "RG1" in the resource group section, give your virtual network a name "app-vnet" and select your preferred region, in our case (US) central US.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hp1p8iuopk2uopp0z2zc.png)

6. To enter the IP Address range for the virtual virtual network, select "ip address" on the top, then input the ip address range in the space allocated.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/436jpj7ek2sq9vf1boay.png)  

7. To create the first subnet, click on "default" enter the required information and click on "save".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mfw3bqvskkgiilpwjev.png) 

8. To create the second subnet, click on "Add a subnet" enter the required information and click on "add". Then, click on review and create and finally, click on create.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orqnk61t8o2ltwn01551.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ozd7addbohjsnoy8a1m.png)

9. To create the second virtual network, fill the required fields

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1wp4fz79tvd86he91qvx.png)

10. To create the subnet for the second virtual network, click on "ip address", click on "default" and fill the required fields and click on "add".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m73mcyuid28iwnipteov.png)

11. After confirming that the subnet have been created, click on "review and create" and then click on "create".
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3lbp3p9272kvt1kk11p.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vqi0gfuxw7c20nu3zpvu.png)

12. Once the deployment is complete. Navigate back to the portal, in the search bar type “resource groups” and select Resource Groups” from the results. Select on “RG1” in the main pane and comfirm both virtual networks have been deployed. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgicla8ndzgaqvionyic.png)

_## **Setup a peer relationship between the virtual networks
**

1. In the Portal, in the RG1 resource group view. Select on the “app-vnet” virtual network. On the left hand side, select "setting" and on drop down click "peerings" 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0i8g1twzv4nh0zif1pbh.png)

2. In the app-vnet peerings pane, Select "+ Add" and fill the required fields, and click on "Add".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n9f4h1nncnldlbiwgk4u.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ik8eqm0c3zj2pp9656t.png)

3. This is to validate that the Peering status is set to Connected.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57rxgknnylk6gqy7uexw.png)