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
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset