O'Reilly logo

Hands-On Networking with Azure by Mohamed Waly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an Azure VM using Azure PowerShell

First, we need to retrieve the virtual network information and store it in a variable by running the following cmdlet:

$VNet = Get-AzureRmVirtualNetwork -Name PSVNet -ResourceGroupName PacktPub

The same also applies for the NSG, which is performed by running the following cmdlet:

$NSG = Get-AzureRmNetworkSecurityGroup -Name PSNSG -ResourceGroupName PacktPub

Next, we need to create a public IP by running the following cmdlet:

$PIP = New-AzureRmPublicIpAddress -ResourceGroupName PacktPub -Location WestEurope -AllocationMethod Dynamic -Name PacktPubVMPIP

After that, we have to create an NIC for the VM by running the following cmdlet:

$NIC = New-AzureRmNetworkInterface -ResourceGroupName PacktPub -Location ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required