An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
When I used your provided policy, I got the same experience. However, I was able to get the deny working with the following policy:
{
"mode": "all",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/networkSecurityGroups/securityRules"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules/access",
"equals": "Allow"
},
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules/direction",
"equals": "Inbound"
},
{
"anyOf": [
{
"field": "Microsoft.Network/networkSecurityGroups/securityRules/destinationPortRange",
"in": [
"22",
"3389"
]
}
]
},
{
"not": {
"field": "Microsoft.Network/networkSecurityGroups/securityRules/sourceAddressPrefix",
"equals": "VirtualNetwork"
}
}
]
},
"then": {
"effect": "deny"
}
},
"parameters": {}
}