{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "resourceName": { "type": "String", "metadata": { "description": "Name of the resource" } }, "settingName": { "defaultValue": "applicationgatewayDiagnostic", "type": "String", "metadata": { "description": "Diagnostic setting Name" } }, "logAnalyticWorkspaceName": { "defaultValue": "testloganaly", "type": "String", "metadata": { "description": "Diagnostic setting Name" } } }, "variables": { "workspaceId": "[resourceid('Microsoft.OperationalInsights/workspaces',parameters('logAnalyticWorkspaceName'))]" }, "resources": [ { "type": "Microsoft.Network/applicationGateways/providers/diagnosticSettings", "apiVersion": "2017-05-01-preview", "name": "[concat(parameters('resourceName'),'/microsoft.insights/', parameters('settingName'))]", "properties": { "name": "DiagService", "storageAccountId": null, "eventHubAuthorizationRuleId": null, "eventHubName": null, "workspaceId": "[variables('workspaceId')]", "logs": [ { "category": "ApplicationGatewayAccessLog", "enabled": true, "retentionPolicy": { "days": 10, "enabled": false } }, { "category": "ApplicationGatewayPerformanceLog", "enabled": true, "retentionPolicy": { "days": 10, "enabled": false } }, { "category": "ApplicationGatewayFirewallLog", "enabled": true, "retentionPolicy": { "days": 10, "enabled": false } } ], "metrics": [ { "category": "AllMetrics", "enabled": true, "retentionPolicy": { "enabled": false, "days": 0 } } ] } } ] }