{
  "properties": {
    "displayName": "Ensure that 'PHP version' is the latest, if used as a part of the WEB app",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Periodically, newer versions are released for PHP software either due to security flaws or to include additional functionality. Using the latest PHP version for web apps is recommended in order to take advantage of security fixes, if any, and/or new functionalities of the latest version. Currently, this policy only applies to Linux web apps.",
    "metadata": {
      "version": "2.1.0",
      "category": "App Service"
    },
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      },
      "PHPLatestVersion": {
        "type": "String",
        "defaultValue": "7.4",
        "metadata": {
          "displayName": "Latest PHP version",
          "description": "Latest supported PHP version for App Services"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/sites"
          },
          {
            "field": "kind",
            "like": "app*"
          },
          {
            "field": "kind",
            "contains": "linux"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Web/sites/config",
          "name": "web",
          "existenceCondition": {
            "anyOf": [
              {
                "field": "Microsoft.Web/sites/config/web.linuxFxVersion",
                 "notContains": "PHP"
              },
              {
                "field": "Microsoft.Web/sites/config/web.linuxFxVersion",
                "equals": "[concat('PHP|', parameters('PHPLatestVersion'))]"
              }
            ]
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/7261b898-8a84-4db8-9e04-18527132abb3",
  "name": "7261b898-8a84-4db8-9e04-18527132abb3"
}