DEV Community

Carlos Mendible
Carlos Mendible

Posted on • Originally published at carlos.mendible.com on

ARM: Enable Container Monitoring Solution on an existing Log Analytics Workspace

Recently I had to update a bunch of Log Analytics Workspaces resources to enable the Container Monitoring Solution in order to monitor some new Azure Kubernetes Services instances. So I came up with this ARM Template that I want to share with you:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "LogAnalyticsWorkspaceName": {
            "type": "string",
            "metadata": {
                "description": "Log Analytics Workspace name"
            }
        }
    },
    "variables": {
        "workspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces/', parameters('LogAnalyticsWorkspaceName'))]",
        "containerSolutionName": "[concat(parameters('LogAnalyticsWorkspaceName'), '-containers')]"
    },
    "resources": [
        {
            "type": "Microsoft.OperationsManagement/solutions",
            "apiVersion": "2015-11-01-preview",
            "name": "[variables('containerSolutionName')]",
            "location": "[resourceGroup().location]",
            "plan": {
                "name": "[variables('containerSolutionName')]",
                "product": "[concat('OMSGallery/', 'ContainerInsights')]",
                "promotionCode": "",
                "publisher": "Microsoft"
            },
            "properties": {
                "workspaceResourceId": "[variables('workspaceResourceId')]"
            }
        }
    ],
    "outputs": {}
}
Enter fullscreen mode Exit fullscreen mode

Hope it helps!

Top comments (0)