Remove-​Azure​Rm​Network​Security​Rule​Config

Removes a network security rule from a network security group.

Syntax

Remove-AzureRmNetworkSecurityRuleConfig
      [-Name <String>]
      -NetworkSecurityGroup <PSNetworkSecurityGroup>
      [<CommonParameters>]

Description

The Remove-AzureRmNetworkSecurityRuleConfig cmdlet removes a network security rule configuration from an Azure network security group.

Examples

Example 1: Remove a network security rule configuration

PS C:\>$rule1 = New-AzureRmNetworkSecurityRuleConfig -Name "rdp-rule" -Description "Allow RDP" -Access "Allow" -Protocol "Tcp" -Direction "Inbound" -Priority 100 -SourceAddressPrefix "Internet" -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389
PS C:\> $nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName "TestRG" -Location "westus" -Name "NSG-FrontEnd" -SecurityRules $rule1
PS C:\> Remove-AzureRmNetworkSecurityRuleConfig -Name "rdp-rule" -NetworkSecurityGroup $nsg

The first command creates a network security rule configuration named rdp-rule, and then stores it in the $rule1 variable.

The second command creates a network security group using the rule in $rule1, and then stores the network security group in the $nsg variable.

The third command removes the network security rule configuration named rdp-rule from the network security group in $nsg.

Required Parameters

-NetworkSecurityGroup

Specifies a NetworkSecurityGroup object. This object contains the network security rule configuration to remove.

Type:PSNetworkSecurityGroup
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters

-Name

Specifies the name of the network security rule configuration that this cmdlet removes.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False