{
   "properties": {
      "displayName": "Require automatic OS image patching on Virtual Machine Scale Sets",
      "policyType": "BuiltIn",
      "mode": "All",
      "description": "This policy enforces enabling automatic OS image patching on Virtual Machine Scale Sets to always keep Virtual Machines secure by safely applying latest security patches every month.",
      "metadata": {
         "version": "1.0.0",
         "category": "Compute"
      },
      "parameters": {},
      "policyRule": {
         "if": {
            "allOf": [
               {
                  "field": "type",
                  "equals": "Microsoft.Compute/virtualMachineScaleSets"
               },
               {
                  "field": "Microsoft.Compute/VirtualMachineScaleSets/upgradePolicy.automaticOSUpgradePolicy.enableAutomaticOSUpgrade",
                  "notEquals": "True"
               },
               {
                  "field": "Microsoft.Compute/VirtualMachineScaleSets/upgradePolicy.automaticOSUpgrade",
                  "notEquals": "True"
               }
            ]
         },
         "then": {
            "effect": "deny"
         }
      }
   },
   "id": "/providers/Microsoft.Authorization/policyDefinitions/465f0161-0087-490a-9ad9-ad6217f4f43a",
   "name": "465f0161-0087-490a-9ad9-ad6217f4f43a"
}