Azure PowerShell Set-AzNetworkSecurityGroup地址前缀无效

gt0wga4j  于 2023-08-07  发布在  Shell
关注(0)|答案(1)|浏览(99)

尝试添加NSG规则时,出现以下错误:

Get-AzNetworkSecurityGroup -ResourceGroupName MYRG -Name MYNSG | Add-AzNetworkSecurityRuleConfig -Name AllowSyslog-Outbound -Access Allow -Protocol * -Direction Outbound -Priority 3001 -SourceAddressPrefix 10.200.32.36 -SourcePortRange * -DestinationAddressPrefix "10.201.0.5,10.201.2.4" -DestinationPortRange (514, 6514) | Set-AzNetworkSecurityGroup

字符串
抛出错误:

Set-AzNetworkSecurityGroup: Security rule /subscriptions/XXX/resourceGroups/MYRG/providers/Microsoft.Network/networkSecurityGroups/MYNSG/securityRules/AllowSyslog-Outbound has invalid Address prefix. Value provided: 10.201.0.5,10.201.2.4
StatusCode: 400
ReasonPhrase: Bad Request
ErrorCode: SecurityRuleInvalidAddressPrefix

zhte4eai

zhte4eai1#

Add-AzNetworkSecurityRuleConfig中使用多个IP地址的正确格式如下:

Get-AzNetworkSecurityGroup -ResourceGroupName MYRG -Name MYNSG `
| Add-AzNetworkSecurityRuleConfig `
-Name AllowSyslog-Outbound -Access Allow -Protocol * `
-Direction Outbound -Priority 3001 `
-SourceAddressPrefix 10.200.32.36 `
-SourcePortRange * `
-DestinationAddressPrefix ("10.201.0.5", "10.201.2.4") `
-DestinationPortRange (514, 6514) `
| Set-AzNetworkSecurityGroup

字符串

相关问题