Configuring VNets and subnets
In this section, we are going to create and configure a VNet and a subnet from the Azure portal. We created both of these in earlier demonstrations, for instance, when we created VMs in Chapter 3, Implementing and Managing Virtual Machines. Now, we are going to cover this topic in more detail.
Here, we are going to configure a VNet and a subnet using PowerShell. Therefore, we have to follow these steps:
- First, we need to log into our Azure account, as follows:
Connect-AzAccount
- If necessary, select the right subscription, as follows:
Select-AzSubscription -SubscriptionId "********-****-****-****- ***********"
- Create a resource group for the VNet as follows:
New-AzResourceGroup -Name PacktVNetResourceGroup -Location EastUS
- Next, we can create the VNet, as follows:
$virtualNetwork = New-AzVirtualNetwork ` -ResourceGroupName PacktVNetResourceGroup ` -Location EastUS ` -Name PacktVirtualNetwork ` -AddressPrefix 10.0.0.0/16
...