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

Associating NSG with a subnet using PowerShell

To associate the NSG that has been created earlier to a subnet, you can run the following cmdlet:

Get-AzureRmVirtualNetwork -ResourceGroupName PacktPub -Name PSVNet| Set-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork PSVNet -Name NSubnet -AddressPrefix 192.168.1.0/24 -NetworkSecurityGroup $NSG

Then, you need to save your configuration by running the following cmdlet:

Set-AzureRmVirtualNetwork -VirtualNetwork PSVNet

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