During this module, you will learn how Microsoft Azure networking provides the infrastructure necessary to securely connect Virtual Machines (VMs) to one another, and be the bridge between the cloud and on-premises datacenter.
After completing the exercises in this module, you will be able to:
- Create a virtual network by using PowerShell.
- Learn how to assign names and subnets to VNETs.
- Completion of Module on Compute
Self-guided
An Azure virtual network (VNet) is a representation of your own network in the cloud. It is a logical isolation of the Azure cloud dedicated to your subscription. You can fully control the IP address blocks, DNS settings, security policies, and route tables within this network. You can also further segment your VNet into subnets and launch Azure IaaS virtual machines (VMs) and/or Cloud services (PaaS role instances). Additionally, you can connect the virtual network to your on-premises network using one of the connectivity options available in Azure. In essence, you can expand your network to Azure, with complete control on IP address blocks with the benefit of enterprise scale Azure provides.
Login-AzureRmAccount
If the subscription ID that is selected by default is different from the one that you want to work in, use either of the following commands to set the right subscription.
Set-AzureRmContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx"
###### or
Select-AzureRmSubscription -SubscriptionId "xxxx-xxxx-xxxx-xxxx"
New-AzureRmResourceGroup -Name TestRG -Location centralus
New-AzureRmVirtualNetwork -ResourceGroupName TestRG -Name TestVNet -AddressPrefix 192.168.0.0/16 -Location centralus
Get-AzureRmVirtualNetwork -ResourceGroupName TestRG -Name TestVNet
$vnet = Get-AzureRmVirtualNetwork -ResourceGroupName TestRG -Name TestVNet
Add-AzureRmVirtualNetworkSubnetConfig -Name FrontEnd -VirtualNetwork $vnet -AddressPrefix 192.168.1.0/24
Add-AzureRmVirtualNetworkSubnetConfig -Name BackEnd -VirtualNetwork $vnet -AddressPrefix 192.168.2.0/24
Although you create subnets, they currently only exist in the local variable used to retrieve the VNet. To verify
Get-AzureRmVirtualNetwork -ResourceGroupName TestRG -Name TestVNet
Set-AzureRmVirtualNetwork -VirtualNetwork $vnet
Get-AzureRmVirtualNetwork -ResourceGroupName TestRG -Name TestVNet
Remove-AzureRmVirtualNetwork -ResourceGroupName TestRG -Name TestVNet -Verbose -Debug