{
    "properties": {
        "displayName": "Audit Windows virtual machines on which the Windows Guest Configuration extension is not enabled",
        "policyType": "BuiltIn",
        "mode": "Indexed",
        "description": "This policy audits Windows virtual machines hosted in Azure that are supported by Guest Configuration but do not have the Guest Configuration extension enabled. For more information on Guest Configuration, visit https://aka.ms/gcpol.",
        "metadata": {
            "version": "2.0.0-deprecated",
            "category": "Guest Configuration",
            "deprecated": true
        },
        "parameters": {
            "effect": {
                "type": "string",
                "metadata": {
                    "displayName": "Effect",
                    "description": "Enable or disable the execution of the policy"
                },
                "allowedValues": [
                    "AuditIfNotExists",
                    "Disabled"
                ],
                "defaultValue": "AuditIfNotExists"
            }
        },
        "policyRule": {
            "if": {
                "allOf": [
                    {
                        "field": "type",
                        "equals": "Microsoft.Compute/virtualMachines"
                    },
                    {
                        "anyOf": [
                            {
                                "field": "Microsoft.Compute/imagePublisher",
                                "in": [
                                    "esri",
                                    "incredibuild",
                                    "MicrosoftDynamicsAX",
                                    "MicrosoftSharepoint",
                                    "MicrosoftVisualStudio",
                                    "MicrosoftWindowsDesktop",
                                    "MicrosoftWindowsServerHPCPack"
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "MicrosoftWindowsServer"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageSKU",
                                        "notLike": "2008*"
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "MicrosoftSQLServer"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageOffer",
                                        "notLike": "SQL2008*"
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "microsoft-dsvm"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageOffer",
                                        "equals": "dsvm-windows"
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "microsoft-ads"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageOffer",
                                        "in": [
                                            "standard-data-science-vm",
                                            "windows-data-science-vm"
                                        ]
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "batch"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageOffer",
                                        "equals": "rendering-windows2016"
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "center-for-internet-security-inc"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageOffer",
                                        "like": "cis-windows-server-201*"
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "pivotal"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageOffer",
                                        "like": "bosh-windows-server*"
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.Compute/imagePublisher",
                                        "equals": "cloud-infrastructure-services"
                                    },
                                    {
                                        "field": "Microsoft.Compute/imageOffer",
                                        "like": "ad*"
                                    }
                                ]
                            },
                            {
                                "allOf": [
                                    {
                                        "anyOf": [
                                            {
                                                "field": "Microsoft.Compute/virtualMachines/osProfile.windowsConfiguration",
                                                "exists": "true"
                                            },
                                            {
                                                "field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
                                                "like": "Windows*"
                                            }
                                        ]
                                    },
                                    {
                                        "anyOf": [
                                            {
                                                "field": "Microsoft.Compute/imageSKU",
                                                "exists": "false"
                                            },
                                            {
                                                "allOf": [
                                                    {
                                                        "field": "Microsoft.Compute/imageSKU",
                                                        "notLike": "2008*"
                                                    },
                                                    {
                                                        "field": "Microsoft.Compute/imageOffer",
                                                        "notLike": "SQL2008*"
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            "then": {
                "effect": "[parameters('effect')]",
                "details": {
                    "type": "Microsoft.Compute/virtualMachines/extensions",
                    "name": "AzurePolicyforWindows",
                    "existenceCondition": {
                        "allOf": [
                            {
                                "field": "Microsoft.Compute/virtualMachines/extensions/publisher",
                                "equals": "Microsoft.GuestConfiguration"
                            },
                            {
                                "field": "Microsoft.Compute/virtualMachines/extensions/type",
                                "equals": "ConfigurationforWindows"
                            },
                            {
                                "field": "Microsoft.Compute/virtualMachines/extensions/provisioningState",
                                "equals": "Succeeded"
                            }
                        ]
                    }
                }
            }
        }
    },
    "id": "/providers/Microsoft.Authorization/policyDefinitions/5fc23db3-dd4d-4c56-bcc7-43626243e601",
    "name": "5fc23db3-dd4d-4c56-bcc7-43626243e601"
}