我正在尝试创建一个审核我的 NSG 的 Azure 策略。
我需要验证我的 NSG 是否包含源和目标匹配且都是 IP 地址的规则(因此不是“虚拟机”)
我目前有以下情况:
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/networkSecurityGroups"
},
{
"count": {
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*]",
"where": {
"allOf": [
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].sourcePortRange",
"equals": "*"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationPortRange",
"equals": "*"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].sourceAddressPrefix",
"match": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationAddressPrefix"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationAddressPrefix",
"match": "Microsoft.Network/networkSecurityGroups/securityRules[*].sourceAddressPrefix"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].access",
"equals": "Allow"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].direction",
"equals": "Inbound"
}
]
}
},
"notEquals": 1
}
]
},
"then": {
"effect": "audit"
}
},
"parameters": {}
}
然而,这表明我的所有核供应国集团都不合规,尽管我知道其中一些是合规的。
这可能吗?
提前致谢