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

Adding an inbound or outbound rule to an Azure VM using Azure PowerShell

To add an inbound or outbound security rule to an Azure VM means you have to add the rule to the NSG assigned to the NIC that was created earlier. Fortunately, doing that isn't difficult.

To add an inbound or outbound rule, you need to run the following cmdlet:

Add-AzureRmNetworkSecurityRuleConfig -NetworkSecurityGroup $NSG -Name HTTP-Rule -Description "Allow HTTP" -Access Allow -Protocol Tcp-Direction Inbound -Priority 1020 -SourceAddressPrefix *-SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 80

After that, you have to save the preceding configuration by running the following cmdlet:

Set-AzureRmNetworkSecurityGroup -NetworkSecurityGroup $NSG
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