Set-​Azure​Rm​Network​Security​Group

Sets the goal state for a network security group.

Syntax

Set-AzureRmNetworkSecurityGroup
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   -NetworkSecurityGroup <PSNetworkSecurityGroup>
   [<CommonParameters>]

Description

The Set-AzureRmNetworkSecurityGroup cmdlet sets the goal state for an Azure network security group.

Examples

Example 1: Set the goal state for a network security group

PS C:\>Get-AzureRmNetworkSecurityGroup -Name "Nsg1" -ResourceGroupName "Rg1" | Add-AzureRmNetworkSecurityRuleConfig -Name "Rdp-Rule" -Description "Allow RDP" -Access "Allow" -Protocol "Tcp" -Direction "Inbound" -Priority 100 -SourceAddressPrefix "Internet" -SourcePortRange "*" -DestinationAddressPrefix "*" -DestinationPortRange "3389" | Set-AzureRmNetworkSecurityGroup

This command gets the Azure network security group named Nsg1, and adds a network security rule named Rdp-Rule to allow Internet traffic on port 3389 to the retrieved network security group object using Add-AzureRmNetworkSecurityRuleConfig. The command persists the modified Azure network security group using Set-AzureRmNetworkSecurityGroup.

Required Parameters

-NetworkSecurityGroup

A network security group object representing the goal state to which the cmdlet sets the network security group.

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

Optional Parameters

-InformationAction

Specifies how this cmdlet responds to an information event.The acceptable values for this parameter are:- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

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