Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rwaal
Last active September 16, 2021 15:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rwaal/3d46c8b97a70750c2cbecf925b31fe92 to your computer and use it in GitHub Desktop.
Save rwaal/3d46c8b97a70750c2cbecf925b31fe92 to your computer and use it in GitHub Desktop.
Configure multiple Azure diagnostic settings with ARM templates
"resources": [
{
"type": "Microsoft.Logic/workflows",
"name": "[parameters('logicAppName')]",
"apiVersion": "2016-10-01",
"location": "[resourceGroup().location]",
"properties": {
"definition": "[parameters('logicAppDefinition')]",
"parameters": {},
"state": "Enabled"
},
"resources": [
{
"type": "providers/diagnosticSettings",
"name": "[concat('Microsoft.Insights/', parameters('diagnosticSettingName01'))]",
"apiVersion": "2017-05-01-preview",
"properties": {
"name": "[parameters('diagnosticSettingName01')]",
"storageAccountId": null,
"eventHubAuthorizationRuleId": null,
"eventHubName": null,
"workspaceId": "[parameters('workspaceId01')]",
"logs": [
{
"category": "WorkflowRuntime",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
}
],
"metrics": [
{
"timeGrain": "PT1M",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Logic/workflows', parameters('logicAppName'))]"
]
},
{
"type": "providers/diagnosticSettings",
"name": "[concat('Microsoft.Insights/', parameters('diagnosticSettingName02'))]",
"apiVersion": "2017-05-01-preview",
"properties": {
"name": "[parameters('diagnosticSettingName02')]",
"storageAccountId": null,
"eventHubAuthorizationRuleId": null,
"eventHubName": null,
"workspaceId": "[parameters('workspaceId02')]",
"logs": [
{
"category": "WorkflowRuntime",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
}
],
"metrics": [
{
"timeGrain": "PT1M",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Logic/workflows', parameters('logicAppName'))]"
]
}
]
}
]
{
"$schema": "https://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "String"
},
"logicAppDefinition": {
"defaultValue": {
"contentVersion": "1.0.0.0",
"parameters": {},
"actions": {},
"triggers": {},
"outputs": {},
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#"
},
"type": "Object"
},
"diagnosticSettingName01": {
"type": "String",
"metadata": {
"description": "Name of the first diagnostic setting."
}
},
"diagnosticSettingName02": {
"type": "String",
"metadata": {
"description": "Name of the second diagnostic setting."
}
},
"workspaceId01": {
"type": "String",
"metadata": {
"description": "Resource Id of OMS workspace used in first diagnostic setting."
}
},
"workspaceId02": {
"type": "String",
"metadata": {
"description": "Resource Id of OMS workspace used in second diagnostic setting."
}
}
},
"resources": [
{
"type": "Microsoft.Logic/workflows",
"name": "[parameters('logicAppName')]",
"apiVersion": "2016-10-01",
"location": "[resourceGroup().location]",
"properties": {
"definition": "[parameters('logicAppDefinition')]",
"parameters": {},
"state": "Enabled"
},
"resources": [
{
"type": "providers/diagnosticSettings",
"name": "[concat('Microsoft.Insights/', parameters('diagnosticSettingName01'))]",
"apiVersion": "2017-05-01-preview",
"properties": {
"name": "[parameters('diagnosticSettingName01')]",
"storageAccountId": null,
"eventHubAuthorizationRuleId": null,
"eventHubName": null,
"workspaceId": "[parameters('workspaceId01')]",
"logs": [
{
"category": "WorkflowRuntime",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
}
],
"metrics": [
{
"timeGrain": "PT1M",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Logic/workflows', parameters('logicAppName'))]"
]
},
{
"type": "providers/diagnosticSettings",
"name": "[concat('Microsoft.Insights/', parameters('diagnosticSettingName02'))]",
"apiVersion": "2017-05-01-preview",
"properties": {
"name": "[parameters('diagnosticSettingName02')]",
"storageAccountId": null,
"eventHubAuthorizationRuleId": null,
"eventHubName": null,
"workspaceId": "[parameters('workspaceId02')]",
"logs": [
{
"category": "WorkflowRuntime",
"enabled": true,
"retentionPolicy": {
"days": 0,
"enabled": false
}
}
],
"metrics": [
{
"timeGrain": "PT1M",
"enabled": true,
"retentionPolicy": {
"enabled": false,
"days": 0
}
}
]
},
"dependsOn": [
"[resourceId('Microsoft.Logic/workflows', parameters('logicAppName'))]"
]
}
]
}
]
}
@m-soltani
Copy link

m-soltani commented Sep 16, 2021

perfect! helped a lot! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment