{
    "type": "Microsoft.Authorization/policyDefinitions",
    "name": "enforce-hybrid-use-benefit",
    "properties": {
        "displayName": "Enforce hybrid use benefit",
        "description": "This policy will enforce usage of hybrid use benefit.",
        "parameters": {},
        "policyRule": {
            "if": {
                "allOf": [
                    {
                        "field": "type",
                        "in": [
                            "Microsoft.Compute/virtualMachines",
                            "Microsoft.Compute/VirtualMachineScaleSets"
                        ]
                    },
                    {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "MicrosoftWindowsServer"
                    },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "equals": "WindowsServer"
                    },
                    {
                        "field": "Microsoft.Compute/imageSKU",
                        "in": [
                            "2008-R2-SP1",
                            "2008-R2-SP1-smalldisk",
                            "2012-Datacenter",
                            "2012-Datacenter-smalldisk",
                            "2012-R2-Datacenter",
                            "2012-R2-Datacenter-smalldisk",
                            "2016-Datacenter",
                            "2016-Datacenter-Server-Core",
                            "2016-Datacenter-Server-Core-smalldisk",
                            "2016-Datacenter-smalldisk",
                            "2016-Datacenter-with-Containers",
                            "2016-Datacenter-with-RDSH"
                        ]
                    },
                    {
                        "field": "Microsoft.Compute/licenseType",
                        "notEquals": "Windows_Server"
                    }
                ]
            },
            "then": {
                "effect": "deny"
            }
        }
    }
}