{
    "properties": {
        "mode": "all",
        "displayName": "Audit Network Security Groups for RDP",
        "description": "This policy audits NSGs with RDP ports enabled",
        "policyRule": {
            "if": {
                "allOf": [{
                        "field": "type",
                        "equals": "Microsoft.Network/networkSecurityGroups"
                    },
                    {
                        "count": {
                            "field": "Microsoft.Network/networkSecurityGroups/securityRules[*]",
                            "where": {
                                "allOf": [{
                                        "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].direction",
                                        "equals": "Inbound"
                                    },
                                    {
                                        "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].access",
                                        "equals": "Allow"
                                    },
                                    {
                                        "field": "Microsoft.Network/networkSecurityGroups/securityRules[*].destinationPortRange",
                                        "equals": "3389"
                                    }
                                ]
                            }
                        },
                        "greater": 0
                    }
                ]
            },
            "then": {
                "effect": "audit"
            }
        }
    }
}