Public/Core/monitoring/New-CmAzCoreMonitor.Logging.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "AppInsightsName": {
            "type": "string"
        },
        "Solutions": {
            "type": "array",
            "defaultValue": [
                {
                    "planName": "KeyVaultAnalytics",
                    "type": "KeyVaultAnalytics"
                },
                {
                    "planName": "AzureActivity",
                    "type": "AzureActivity"
                },
                {
                    "planName": "AgentHealthAssessment",
                    "type": "AgentHealthAssessment"
                },
                {
                    "planName": "Updates",
                    "type": "Updates"
                },
                {
                    "planName": "VMInsights",
                    "type": "VMInsights"
                },
                {
                    "planName": "ServiceMap",
                    "type": "ServiceMap"
                }
            ]
        },
        "WorkspaceName": {
            "type": "string"
        },
        "ServiceContainer": {
            "type": "object"
        }
    },
    "variables": {
    },
    "resources": [
        {
            "type": "Microsoft.Insights/components",
            "apiVersion": "2014-04-01",
            "name": "[parameters('AppInsightsName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "cm-service": "[parameters('ServiceContainer').appInsights]"
            },
            "properties": {
                "ApplicationId": "[parameters('AppInsightsName')]"
            }
        },
        {
            "type": "Microsoft.OperationalInsights/workspaces",
            "apiVersion": "2015-11-01-preview",
            "name": "[parameters('workspaceName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "cm-service": "[parameters('ServiceContainer').workspace]"
            },
            "properties": {
                "sku": {
                    "name": "pergb2018"
                },
                "retentionInDays": 90,
                "features": {
                    "searchVersion": 1,
                    "legacy": 0,
                    "enableLogAccessUsingOnlyResourcePermissions": true
                }
            }
        },
        {
            "name": "[concat(parameters('workspaceName'), '/', subscription().subscriptionId)]",
            "type": "Microsoft.OperationalInsights/workspaces/dataSources",
            "apiVersion": "2015-11-01-preview",
            "properties": {
                "linkedResourceId": "[concat(subscription().Id, '/providers/Microsoft.Insights/eventTypes/management')]"
            },
            "kind": "AzureActivityLog",
            "dependsOn": [
                "[parameters('workspaceName')]"
            ]
        },
        {
            "apiVersion": "2015-11-01-preview",
            "type": "Microsoft.OperationsManagement/Solutions",
            "location": "[resourceGroup().location]",
            "name": "[concat(parameters('Solutions')[copyIndex('SolutionsCopy')].type, '(', parameters('workspaceName'), ')')]",
            "id": "[resourceId('microsoft.operationsManagement/Solutions', concat(parameters('Solutions')[copyIndex('SolutionsCopy')].type, '(', parameters('workspaceName'), ')'))]",
            "tags": {
                "cm-service": "[parameters('ServiceContainer').solution]"
            },
            "properties": {
                "workspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspaceName'))]"
            },
            "dependsOn": [
                "[parameters('workspaceName')]"
            ],
            "plan": {
                "name": "[concat(parameters('Solutions')[copyIndex('SolutionsCopy')].type, '(', parameters('workspaceName'), ')')]",
                "product": "[concat('OMSGallery/', parameters('Solutions')[copyIndex('SolutionsCopy')].type)]",
                "promotionCode": "",
                "publisher": "Microsoft"
            },
            "copy": {
                "name": "SolutionsCopy",
                "count": "[length(parameters('Solutions'))]"
            }
        }
    ]
}