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

Attaching an NIC to an Azure VM using Azure PowerShell

Since adding an NIC to an Azure VM requires the VM to be in a Stopped (Deallocated) state, you will have to run the following cmdlets:

$VM = Get-AzureRMVM -Name PacktPubVMPS -ResourceGroupName PacktPubStop-AzureRMVM -Name $VM -ResourceGroupName PacktPub

Next, you have to retrieve the subnet info to which the NIC will be assigned by running the following cmdlet:

$Subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name NSubnet-VirtualNetwork $VNet

After that, you can create the additional NIC by running the following cmdlet:

$AdditionalNIC = New-AzureRmNetworkInterface -ResourceGroupName PacktPub -Name AddNICPS -Location WestEurope -SubnetId $Subnet.Id

You can also create the NIC using the ...

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