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 difference between inbound and outbound rules is the Direction parameter, which depends on whether it has been specified as  Inbound or Outbound.
..................Content has been hidden....................

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