We have already seen how to configure the VNet on the Azure from the console and today we will look at how to create the VNet from the Powershell also we will look at basic Powershell commands to help you on the VNet operations.
- First command is to create a resource group named “RenResourceGroup” in the Central India location.
2. Next one is adding a virtual network segment called “RenVNET01” with the Address range of 220.127.116.11/16 under the RenResourceGroup resource group.
3. Before we add the subnets to the Virtual Network we need to store the definition in a variable as below $vnet
You can check the variable by entering $vnet on the powershell
4. Now we will add the first subnets under the VNet that we created called RenVNET01. While adding the subnet range make sure it is within the address range that we specified for the VNet
Now let’s add the second subnet in to the variable as below.
You need to keep in mind that these definitions are loaded on the variable called Vnet. So we need to write these definition to the azure subscription.
5. Below set command will write those definitions stored on the variable.
This can be verified in different ways! Either you can go to your azure console then check the resource groups and vnets created in that resource group or you can use the powershell way to get the configurations
You can enter below command to get the subnets informations that we added just now.
Get-AzureRmVirtualNetwork -ResourceGroupName renResourcegroup -Name renvnet01
If you are performing these actions from the PowerShell then you may not see them on the notification area under the console. So there is only one way to see the activity details by looking at the Monitor>Activity log viewer.