New-AzFirewallNetworkRule
语法
Default (默认值)
New-AzFirewallNetworkRule
-Name <String>
[-Description <String>]
[-SourceAddress <String[]>]
[-SourceIpGroup <String[]>]
[-DestinationAddress <String[]>]
[-DestinationIpGroup <String[]>]
[-DestinationFqdn <String[]>]
-DestinationPort <String[]>
-Protocol <String[]>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[-AcquirePolicyToken]
[-ChangeReference <String>]
[<CommonParameters>]
说明
New-AzFirewallNetworkRule cmdlet 为Azure 防火墙创建网络规则。
示例
示例 1:为所有 TCP 流量创建规则
$rule = New-AzFirewallNetworkRule -Name "all-tcp-traffic" -Description "Rule for all TCP traffic" -Protocol TCP -SourceAddress "*" -DestinationAddress "*" -DestinationPort "*"
此示例为所有 TCP 流量创建规则。 用户根据规则集合强制执行该规则所关联的规则是允许还是拒绝流量。
示例 2:为所有从 10.0.0.0 到 60.1.5.0:4040 的所有 TCP 流量创建规则
$rule = New-AzFirewallNetworkRule -Name "partial-tcp-rule" -Description "Rule for all TCP traffic from 10.0.0.0 to 60.1.5.0:4040" -Protocol TCP -SourceAddress "10.0.0.0" -DestinationAddress "60.1.5.0" -DestinationPort "4040"
此示例为从 10.0.0.0 到 60.1.5.0:4040 的所有 TCP 流量创建规则。 用户根据规则集合强制执行该规则所关联的规则是允许还是拒绝流量。
示例 3:为所有源到 10.0.0.0/16 的所有 TCP 和 ICMP 流量创建规则
$rule = New-AzFirewallNetworkRule -Name "tcp-and-icmp-rule" -Description "Rule for all TCP and ICMP traffic from any source to 10.0.0.0/16" -Protocol TCP,ICMP -SourceAddress * -DestinationAddress "10.0.0.0/16" -DestinationPort *
此示例为从任何源到 10.0.0.0/16 的所有 TCP 流量创建规则。 用户根据规则集合强制执行该规则所关联的规则是允许还是拒绝流量。
参数
-AcquirePolicyToken
自动获取此资源操作的Azure Policy令牌。
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-ChangeReference
此资源操作的更改引用资源 ID。
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-Description
指定此规则的可选说明。
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-DestinationAddress
规则的目标地址
参数属性
类型: String [ ]
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-DestinationFqdn
规则的目标 FQDN
参数属性
类型: String [ ]
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-DestinationIpGroup
规则的目标 IP 组
参数属性
类型: String [ ]
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-DestinationPort
规则的目标端口
参数属性
类型: String [ ]
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-Name
指定此网络规则的名称。 名称在规则集合中必须是唯一的。
参数属性
类型: String
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-Protocol
指定要按此规则筛选的流量的类型。 可能的值为 TCP、UDP、ICMP 和 Any。
参数属性
类型: String [ ]
默认值: None
接受的值: Any, TCP, UDP, ICMP
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: True
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-SourceAddress
规则的源地址
参数属性
类型: String [ ]
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-SourceIpGroup
规则的源 IP 组
参数属性
类型: String [ ]
默认值: None
支持通配符: False
不显示: False
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
-WhatIf
显示 cmdlet 运行时会发生什么情况。
命令脚本未运行。
参数属性
参数集
(All)
Position: Named
必需: False
来自管道的值: False
来自管道的值(按属性名称): False
来自剩余参数的值: False
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters 。
None
输出