in

How to create a Virtual Network in Azure?

Azure Virtual Network (VNet) is the fundamental building block for your private network in Azure. VNet is similar to a traditional network that you’d operate in your data center but brings with it additional benefits of Azure’s infrastructure such as scale, availability, and isolation.

What is an Azure Virtual Network(Vnet)?

You can consider a VNet as your own network available in the cloud or as your own Datacenter. You can run your applications and Virtual Machines in this virtual network. It will provide you a highly secured environment. You can also link your Vnets with each other and even with your on-premises Data Centers. 

What’s the pricing of Azure Virtual Network?

Zero! Azure Vnet is a completely free service for users. You can create up to 50 virtual networks in an Azure Account and can deploy your services in it. 

How can you create an Azure Virtual Network?

You can create a Vnet through:

  • Azure portal
  • PowerShell
  • Azure CLI

Here in this blog, you will learn how you can create a Virtual Network in your Azure account with your Azure Portal. Just follow the given process: 

  1. Open your Azure Portal.
  2. Search for Virtual Network in the search box and open it.

3. Now on the Virtual Network dashboard click on “Create Virtual Network” or “Add”.

4. Here you need to provide some info about your Virtual Network.

Subscription:        Choose your Subscription available

Resource Group:  Click on create new. 

                               Create a new one name according to your choice. 

Instance Name:    myvn or anything that you like.

Region:                 Choose your Region.

5. Click on “Next: IP Addresses”.

6. In the IP Addresses field, write a new IP Address. The range of addresses would be written there. I.e. 10.1.0.0/16

7. Click on “Add Subnet” and add a new subnet. The range of your subnet must be according to your IP Address. I.e. 10.1.0.0/24

8. Click on “Next: Security”. If you want to make any changes in security. Enable the BastionHost and provide details as: 

Bastion name: Anything of your choice or just enter “myBastionHost”.

Azure Bastion Subnet address space: 10.1.1.0/24

Public IP Address: Create New and enter “myBastionIP” as a name.

9. Add tags if you want otherwise click on Review. 

10.Once the review is done. Click on create. 

11. Your Virtual Network will be created in a few minutes. 

Congratulations! You just created your first Virtual Network(Vnet) in Azure. Now you can deploy your Applications and VMs in this Vnet. 

Create a Virtual Network in Azure using PowerShell

We have already created a Virtual Network with Azure Portal. Now let’s have a look at how to create a Vnet with PowerShell.

So if you want to use the PowerShell locally, then install the Azure PowerShell module version 5.4.1 or later. And use the ‘connect-AzAccount’ command to create a connection with your Azure account.

1. Create a resource group

So before starting with the Vnet creation process, let’s create a resource group first. You can use the following command in PowerShell for it:

$rg = @{

    Name = ‘myresourcegroup’

    Location = ‘EastUS’

}

New-AzResourceGroup @r

 

This command will create a resource group named ‘myresourcegroup’ in the East US region.

2. Create a Virtual Network

Use the following command to create a ‘myvnet’ named Virtual Network in the East US region. 

$vnet = @{

    Name = ‘myVNet’

    ResourceGroupName = ‘myresourcegroup’

    Location = ‘EastUS’

    AddressPrefix = ‘10.0.0.0/16’    

}

$virtualNetwork = New-AzVirtualNetwork @vne

3. Add a Subnet to your Virtual Network 

Use the following command to create a subnet named ‘mysubnet’.

$subnet = @{

    Name = ‘mysubnet’

    VirtualNetwork = $virtualNetwork

    AddressPrefix = ‘10.0.0.0/24’

}

$subnetConfig = Add-AzVirtualNetworkSubnetConfig @subnet

Now we need to associate the subnet with our Virtual Network. 

$virtualNetwork | Set-AzVirtualNetwork

Now you have successfully created a Virtual Network with Azure Powershell and associated a Subnet with it. 

 

What do you think?

Written by DANN N

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

0