Table of contents
1.
Introduction
2.
Benefits
2.1.
Communication With The Internet
2.2.
Communication between Azure Resources
2.3.
Communication with On-Premises Resources
2.4.
Filtering Network Traffic
2.5.
Routing Network Traffic
2.6.
Integration of Virtual Network with Azure Services
3.
Creating a VNet
3.1.
Creating a Resource Group
3.2.
Creating the VNet
3.3.
Adding a Subnet
4.
Creating Virtual Machines
5.
Communicating Between VMs
5.1.
Step 1
5.2.
Step 2
6.
Clean Up Resources
7.
Frequently Asked Questions
7.1.
What is Azure Virtual Network?
7.2.
What is ICMP?
7.3.
What is Azure?
7.4.
What is Cloud?
7.5.
What is DNS?
8.
Conclusion
Last Updated: Mar 27, 2024
Medium

Azure Virtual Network

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Azure Vnet or Azure Virtual Network is the fundamental building block for any Azure private network. Azure Virtual Network is used to enable various Azure resources, such as Virtual Machines, to communicate securely amongst themselves, with other on-premises networks and the internet. Azure Virtual Network brings many additional benefits such as isolation, availability, and scale to the table. This blog will discuss the benefits of using the Azure Virtual Network. We will also learn to configure Azure Virtual Network using Azure PowerShell.

Benefits of Azure

Benefits

Azure Virtual Network is vital for a secure connection between various Azure resources. Let us look at why one should opt for the Azure Virtual Network.

Communication With The Internet

Azure Virtual Network is widely used to create a secure connection between the Azure resources and the internet. Users do not need to configure any settings to create a communication with the internet. It is a default Azure Virtual Network feature.

Communication between Azure Resources

Azure resources can communicate amongst themselves using various methods. Let us talk about these methods of communication.

  •  Communication through the Virtual Network:  Azure resources can communicate securely amongst themselves using the Azure Virtual Network. Users can deploy various Azure resources such as Virtual Machines, Azure Kubernetes Service, Azure Web Service Environments, etc.
  • Communication through the Virtual Network Peering: Users can also connect multiple Virtual Networks to each other to enable Azure resource sharing. The connected virtual networks may be from different regions. This is one of the most powerful features of the Azure Virtual Network.
  • Communication through the Virtual Network Service Endpoint: Users can extend the private address space of their Virtual Network over a direct connection. The Service Endpoints allow users to secure the crucial Azure Service Resources to a particular Virtual Network.

Communication with On-Premises Resources

Users can also connect their on-premises resources, such as computers, to the Azure Virtual Network using any of the following methods,

  • Site-To-Site Virtual Private Network: This is established between the Azure VPN gateway and the on-premises VPN. This method allows an authorized on-premises resource to access the Azure Virtual Network. 
Site to Site VPN
  • Point-To-Site VPN: This type of connection is established between the Azure Virtual Network and a single on-premises computer. This is a very good option for beginners who are learning to set up connections using Azure. Each computer needs to separately configure its connection to connect with the Virtual Network.
Point to Site VPN
  • Azure ExpressRoute: In this method, the connection is created between the on-premises network and the Azure Virtual Network using an ExpressRoute partner.

Filtering Network Traffic

Users can filter the network traffic using any one of the following methods,

  • Network Virtual Appliances: The Network Virtual Appliance is a function that is used to perform various security functions such as WAN optimization, firewall, etc. 
  • Network Security Groups: The network security groups contain various inbound and outbound security measures that are used to filter the network traffic.

Routing Network Traffic

Users can efficiently route the traffic to various resources such as subnets, the internet, on-premises networks, virtual networks, etc. Let us look at some of the methods used to route the network traffic. 

  • Border Gateway Protocol(BGP) Routes: Users can propagate their BGP routes for the on-premises network to their virtual network.
  • Route Tables: Users can also create custom routing tables to control the network traffic.

Integration of Virtual Network with Azure Services

Users can easily integrate the Azure Virtual Network with various Azure Services. This, in turn, allows private access to the Azure Services from the virtual networks. 

Creating a VNet

We can create a Virtual Network by using the following steps.

Creating a Resource Group

We can easily create a new resource group by typing the following command in our Azure PowerShell,

$location = "CentralIndia"
New-AzResourceGroup -Name CodingNinjas -Location $location

Creating the VNet

We can create a Virtual Network using the New-AzVirtualNetwork command,

$virtualnet = @{
    Name = 'VirtualNetwork'
    ResourceGroupName = 'CodingNinjas'
    Location = 'CentralIndia'
    AddressPrefix = '10.0.0.0/16'    
}

$virtualNetwork = New-AzVirtualNetwork @virtualnet

Adding a Subnet

Now that we have created the Virtual Net we will create a subnet and associate the subnet with the Virtual Network.

#creating a subnet
$subnet = @{
    Name = 'subnetOne'
    VirtualNetwork = $virtualNetwork
    AddressPrefix = '10.0.0.0/24'
}
$subnetConfig = Add-AzVirtualNetworkSubnetConfig @subnet

#Associating the subnet
$virtualNetwork | Set-AzVirtualNetwork

Creating Virtual Machines

Now we will create two virtual machines to add to the Virtual Network,

#Creating first virtual machine
$vm1 = @{
    ResourceGroupName = 'CodingNinjas'
    Location = 'CentralIndia'
    Name = 'virtualMachine1'
    VirtualNetworkName = 'VirtualNetwork'
    SubnetName = 'subnetOne'
}
New-AzVM @vm1

#Creating second virtual machine
$vm2 = @{
    ResourceGroupName = 'CodingNinjas'
    Location = 'CentralIndia'
    Name = 'virtualMachine2'
    VirtualNetworkName = 'VirtualNetwork'
    SubnetName = 'subnetOne'
}
New-AzVM @vm2

Communicating Between VMs

We can easily communicate between the virtual machines using the following steps,

Step 1

First, we will need to allow VM1 and VM2 to communicate with each other. To do that, we will have to run the following command on both virtual machines.

New-NetFirewallRule –DisplayName "Allow ICMPv4-In" –Protocol ICMPv4

This command allows the system to communicate over Internet Control Message Protocol(ICMP).

Step 2

Now we can easily ping Virtual Machine1 from Virtual Machine 2 using the following command.

ping virtualMachine2

Clean Up Resources

You can efficiently clean up the Virtual Network by simply deleting the created resource using the following command,

Remove-AzResourceGroup -Name CodingNinjas

Frequently Asked Questions

What is Azure Virtual Network?

Azure Vnet or Azure Virtual Network is the fundamental building block for any Azure private network. Azure Virtual Network is used to enable various Azure resources, such as Virtual Machines, to communicate securely amongst themselves, with other on-premises networks and the internet.

What is ICMP?

ICMP stands for Internet Control Message Protocol. The Internet Control Message Protocol is a part of the Internet Protocol and is used to transmit error messages and operational information to devices in a network.

What is Azure?

Azure is one of the largest Cloud Services provided by Microsoft. Azure is generally used for application management. Azure provides the clients with Platform as a Service(PaaS), Software as a Service(SaaS), and Infrastructure as a Service(IaaS).

What is Cloud?

Cloud is nothing but the servers that are accessed over the internet. It also consists of the software and the database used to run these servers.

What is DNS?

DNS stands for Domain Name System. Domain Name System is a service that is used to convert a hostname to an IP address. DNS is an application layer protocol that helps the clients and the servers communicate.

Conclusion

This blog covered all the necessary points about Azure Virtual Network. We further looked at the features of the Azure Virtual Network. We also learned to set up Azure Virtual Network using Azure PowerShell.

Do check out our blogs on object-oriented programming and data structures

Don’t stop here. Check out Coding Ninjas for more unique courses and guided paths. Also, try Coding Ninjas Studio for more exciting articles, interview experiences, and fantastic Data Structures and Algorithms problems.

Thank You Image
Live masterclass