Cloud

How to create a cloud-based virtual network in Microsoft Azure

Virtual networks provide the secure connection vital to the effective use of cloud-based services.

No matter what cloud infrastructure your enterprise chooses to deploy or which service or services it chooses to use in support of that cloud infrastructure, to be truly effective there must be a secure, flexible way to connect each of the various cloud-based resources. This is where a virtual network comes into play.

A virtual network connects services and resources like virtual machines and database applications with each other and the rest of the internet via a secure, encrypted, and private network. The virtual network provides a framework that gives your enterprise cloud infrastructure substance.

Creating a virtual network in Microsoft Azure can be accomplished through the Azure Portal or with another supported scripting languages. Of course, regardless of how you create a virtual network in Azure, you need to log in with the appropriate administrative credentials and privileges.

SEE: Vendor comparison: Microsoft Azure, Amazon AWS, and Google Cloud (Tech Pro Research)

Create a virtual network with the Azure Portal

After logging into Azure with your administrative credentials, navigate to the virtual network section by either clicking Virtual networks in the left navigation panel and clicking Add (Figure A) or clicking Create a resource | Networking | Virtual network.

Figure A

acreatevirtualnetworkazure.png
Figure A

Following the boxes in order, first, name your virtual network, preferably something memorable and meaningful. Next, provide an address space. The common choice is 10.1.0.0/16, but if you prefer to use a different address feel free. Next, select the subscription to apply this new virtual network to—in the example it is a Free Trial.

The next box asks, which resource group you would like to use. You may need to enter a new group or associate the network with an old resource group if one is established. Then pick a location to use as the basis for your virtual network—pick a location that is close to your location to increase performance. Give the subnet a name and then fill in the subnet address, which for our example is 10.1.0.0/24. Figure B shows the full example virtual network.

Figure B

bcreatevirtualnetworkazure.png
Figure B

Unless you have specific reasons for doing so, leave the rest of the configuration parameters set to their default settings. When all of the parameters are set the way you want them, click the Create button. It may take a few minutes for the allocation and deployment process to finish.

Once complete, you should see your new virtual network on your Azure Portal dashboard as shown in Figure C. From here you can manage your virtual network and attach additional Azure resources to it like virtual machines.

Figure C

ccreatevirtualnetworkazure.png
Figure C

Create a virtual network with scripts

While creating virtual networks using the Azure Portal works great for small deployments, some admins will prefer to create their virtual networks using a scripting language like PowerShell. As you can imagine, creating a virtual network in this manner is a bit more complicated and is intended for IT professionals operating at scale.

The first step is to install the AzureRM PowerShell module version 5.4.1. Then, open a PowerShell session and log into Azure with the Connect-AzureRmAccount command. Next, create a resource group for your virtual network with a command that looks similar to the following:

New-AzureRmResourceGroup -Name myResourceGroup -Location EastUS

Then create a virtual network:

$virtualNetwork = New-AzureRmVirtualNetwork `

-ResourceGroupName myResourceGroup `

-Location EastUS `

-Name myVirtualNetwork `

-AddressPrefix 10.0.0.0/16

Then a subnet:

$subnetConfig = Add-AzureRmVirtualNetworkSubnetConfig `

-Name default `

-AddressPrefix 10.0.0.0/24 `

-VirtualNetwork $virtualNetwork

Then, finally, you must associate the subnet to the virtual network:

$virtualNetwork | Set-AzureRmVirtualNetwork

Your overall experience with scripting languages and allocating network resources as an admin and IT professional will go a long way toward determining which method is preferred. Either method will achieve the same result.

Also see

About Mark Kaelin

Mark W. Kaelin has been writing and editing stories about the IT industry, gadgets, finance, accounting, and tech-life for more than 25 years. Most recently, he has been a regular contributor to BreakingModern.com, aNewDomain.net, and TechRepublic.

Editor's Picks

Free Newsletters, In your Inbox