Public/Deploy/Core/monitoring/New-CmAzCoreMonitor.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "ActionGroups": { "type": "Array" }, "Alerts": { "type": "Array" }, "AppInsightsName": { "type": "String" }, "StorageDataRetentionInDays": { "type": "Int" }, "WorkspaceDataRetentionInDays": { "type": "Int" }, "ServiceContainer": { "type": "Object" }, "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" } ] }, "StorageAccountId": { "type": "String" }, "WorkspaceName": { "type": "String" }, "Workbook": { "type": "object" } }, "variables": { "workspaceResourceId": "[resourceid('Microsoft.OperationalInsights/workspaces', parameters('workspaceName'))]" }, "resources": [ { "condition": "[not(empty(parameters('ServiceContainer').workspace))]", "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": "[parameters('WorkspaceDataRetentionInDays')]", "features": { "searchVersion": 1, "legacy": 0, "enableLogAccessUsingOnlyResourcePermissions": true } } }, { "type": "Microsoft.OperationalInsights/workspaces/providers/diagnosticSettings", "apiVersion": "2017-05-01-preview", "name": "[concat(parameters('workspaceName'), '/Microsoft.Insights/Diagnostics')]", "dependsOn": [ "[parameters('workspaceName')]" ], "properties": { "workspaceId": "[variables('workspaceResourceId')]", "storageAccountId": "[parameters('StorageAccountId')]", "metrics": [ { "category": "AllMetrics", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } } ], "logs": [ { "category": "Audit", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } } ] } }, { "condition": "[not(empty(parameters('ServiceContainer').appInsights))]", "type": "Microsoft.Insights/Components", "apiVersion": "2020-02-02", "name": "[parameters('AppInsightsName')]", "location": "[resourceGroup().location]", "tags": { "cm-service": "[parameters('ServiceContainer').appInsights]" }, "kind": "web", "properties": { "Application_Type": "web", "WorkspaceResourceId": "[variables('workspaceResourceId')]" }, "dependsOn": [ "[parameters('workspaceName')]" ] }, { "type": "Microsoft.Insights/Components/providers/diagnosticSettings", "apiVersion": "2017-05-01-preview", "name": "[concat(parameters('appInsightsName'), '/Microsoft.Insights/Diagnostics')]", "dependsOn": [ "[parameters('appInsightsName')]" ], "properties": { "workspaceId": "[variables('workspaceResourceId')]", "storageAccountId": "[parameters('StorageAccountId')]", "metrics": [ { "category": "AllMetrics", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } } ], "logs": [ { "category": "AppAvailabilityResults", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppBrowserTimings", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppEvents", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppMetrics", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppDependencies", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppExceptions", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppPageViews", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppPageViews", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppPerformanceCounters", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppSystemEvents", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppRequests", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } }, { "category": "AppTraces", "enabled": true, "retentionPolicy": { "enabled": true, "days": "[parameters('StorageDataRetentionInDays')]" } } ] } }, { "condition": "[not(empty(parameters('ServiceContainer').workspace))]", "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'))]" } }, { "type": "Microsoft.Insights/ActionGroups", "apiVersion": "2019-03-01", "name": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].name]", "location": "Global", "tags": { "cm-service": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].service.publish.actionGroup]" }, "properties": { "groupShortName": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].shortName]", "enabled": true, "armRoleReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].armRoles]", "automationRunbookReceivers": "[parameters('actionGroups')[copyIndex('ActionGroupCopy')].runbooks]", "azureAppPushReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].notifications]", "azureFunctionReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].functions]", "emailReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].emails]", "itsmReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].itsm]", "logicAppReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].logicApps]", "smsReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].sms]", "voiceReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].voice]", "webhookReceivers": "[parameters('ActionGroups')[copyIndex('ActionGroupCopy')].webhooks]" }, "copy": { "name": "ActionGroupCopy", "count": "[length(parameters('ActionGroups'))]" } }, { "type": "Microsoft.Insights/ActivityLogAlerts", "apiVersion": "2020-10-01", "name": "[parameters('Alerts')[copyIndex('AlertsCopy')].name]", "location": "Global", "tags": { "cm-service": "[parameters('Alerts')[copyIndex('AlertsCopy')].servicePublish]" }, "properties": { "enabled": "[parameters('Alerts')[copyIndex('AlertsCopy')].enabled]", "scopes": [ "[subscription().Id]" ], "condition": { "allOf": "[parameters('Alerts')[copyIndex('AlertsCopy')].conditions]" }, "actions": { "actionGroups": [ { "actionGroupId": "[resourceId('Microsoft.Insights/ActionGroups', parameters('Alerts')[copyIndex('AlertsCopy')].actionGroupName)]", "webhookProperties": {} } ] } }, "copy": { "name": "AlertsCopy", "count": "[length(parameters('Alerts'))]" } }, { "condition": "[not(parameters('Workbook').exists)]" , "name": "[parameters('Workbook').Guid]", "type": "microsoft.insights/workbooks", "location": "[resourceGroup().location]", "apiVersion": "2018-06-17-preview", "dependsOn": [], "kind": "shared", "tags": { "cm-service": "[parameters('ServiceContainer').workbook]" }, "properties": { "displayName": "[parameters('Workbook').DisplayName]", "sourceId": "Azure Monitor", "serializedData": "[parameters('Workbook').serializedJson]", "version": "1.0", "category": "[parameters('Workbook').category]" } } ] } |