{
    "properties": {
        "displayName": "Configure Azure Monitor Agent to Linux virtual machines and associate to Data Collection Rule",
        "policyType": "BuiltIn",
        "description": "Deploy Azure Monitor Agent for Linux virtual machines if the virtual machine image (OS) and location are in the list defined and the agent is not installed.  Then, deploy Association to link virtual machine to specified Data Collection Rule. The list of OS images is updated over time as support is increased.",
        "metadata": {
            "version": "1.0.0",
            "category": "Monitoring"
        },
        "parameters": {
            "effect": {
                "type": "String",
                "metadata": {
                    "displayName": "Effect",
                    "description": "Enable or disable the execution of the policy."
                },
                "allowedValues": [
                    "DeployIfNotExists",
                    "Disabled"
                ],
                "defaultValue": "DeployIfNotExists"
            },
            "listOfLinuxImageIdToInclude": {
                "type": "Array",
                "metadata": {
                    "displayName": "Optional: List of virtual machine images that have supported Linux OS to add to scope",
                    "description": "Example value: '/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'"
                },
                "defaultValue": []
            },
            "DcrResourceId": {
                "type": "String",
                "metadata": {
                    "displayName": "Data Collection Rule resource Id",
                    "description": "Resource Id of the Data Collection Rule that the virtual machines in scope should point to."
                }
            }
        },
        "policyDefinitions": [
            {
                "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/a4034bc6-ae50-406d-bf76-50f4ee5a7811",
                "policyDefinitionReferenceId": "deployAzureMonitoringAgentLinux",
                "parameters": {
                    "effect": {
                        "value": "[parameters('effect')]"
                    },
                    "listOfLinuxImageIdToInclude": {
                        "value": "[parameters('listOfLinuxImageIdToInclude')]"
                    }
                }
            },
            {
                "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/2ea82cdd-f2e8-4500-af75-67a2e084ca74",
                "policyDefinitionReferenceId": "associateDataCollectionRuleLinux",
                "parameters": {
                    "effect": {
                        "value": "[parameters('effect')]"
                    },
                    "listOfLinuxImageIdToInclude": {
                        "value": "[parameters('listOfLinuxImageIdToInclude')]"
                    },
                    "DcrResourceId": {
                        "value": "[parameters('DcrResourceId')]"
                    }
                }
            }
        ]
    },
    "id": "/providers/Microsoft.Authorization/policySetDefinitions/118f04da-0375-44d1-84e3-0fd9e1849403",
    "name": "118f04da-0375-44d1-84e3-0fd9e1849403"
}