Edit

Share via


Set-AzureNetworkSecurityRule

Adds or modifies a network security rule in a network security group.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Default (Default)

Set-AzureNetworkSecurityRule
    -Name <String>
    -Type <String>
    -Priority <Int32>
    -Action <String>
    -SourceAddressPrefix <String>
    -SourcePortRange <String>
    -DestinationAddressPrefix <String>
    -DestinationPortRange <String>
    -Protocol <String>
    -NetworkSecurityGroup <INetworkSecurityGroup>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

Description

The Set-AzureNetworkSecurityRule cmdlet adds or modifies an Azure network security rule in a network security group.

Parameters

-Action

Specifies the action for a network security rule. Valid values are: Allow and Deny.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DestinationAddressPrefix

Specifies the Classless Interdomain Routing (CIDR) address of the destination IP range for the network security rule. An asterisk (*) specifies any IP address.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DestinationPortRange

Specifies a destination port range for the network security rule. Valid values consist of integers from 0 to 65535. You can specify an individual value, or specify a range in the format LowerNumber-HigherNumber. A hyphen separates the two values.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name for the network security rule that this cmdlet adds or modifies.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NetworkSecurityGroup

Specifies the network security group that this cmdlet modifies. To obtain an INetworkSecurityGroup object, use the Get-AzureNetworkSecurityGroup cmdlet.

Parameter properties

Type:INetworkSecurityGroup
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Priority

Specifies the priority for the network security rule. Valid values are: integers from 100 to 4096.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Protocol

Specifies the protocol for the network security rule. Valid values are:

  • TCP
  • UDP

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SourceAddressPrefix

Specifies the CIDR address of the source IP range for the network security rule. An asterisk (*) specifies any IP address.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SourcePortRange

Specifies a source port range for the network security rule. Valid values consist of integers from 0 to 65535. You can specify an individual value, or specify a range in the format LowerNumber-HigherNumber. A hyphen separates the two values.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Type

Specifies the type of connection for the network security rule. Valid values are: Inbound and Outbound.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.