In this section, we are going to create and configure a virtual network and a subnet from the Azure portal. We created both of these in earlier demonstrations, for instance, when we created VMs. Now, we are going to cover this topic in more detail.
Here, we are going to configure a virtual network and a subnet using PowerShell. Therefore, we have to perform the following 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
- Then, we can create the subnet...