Gallery › Monitoring › Azure Landing Zones Library
[Deprecated] Diagnostic Settings for MariaDB to Log Analytics Workspace
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 1.1.0-deprecated Deprecated
Deploys the diagnostic settings for MariaDB to stream to a Log Analytics workspace when any MariaDB which is missing this diagnostic settings is created or updated. The Policy will set the diagnostic with all metrics and category enabled. Deprecating due to service retirement, https://learn.microsoft.com/en-us/azure/mariadb/whats-happening-to-mariadb
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"name": "Deploy-Diagnostics-MariaDB",
"properties": {
"description": "Deploys the diagnostic settings for MariaDB to stream to a Log Analytics workspace when any MariaDB which is missing this diagnostic settings is created or updated. The Policy will set the diagnostic with all metrics and category enabled. Deprecating due to service retirement, https://learn.microsoft.com/en-us/azure/mariadb/whats-happening-to-mariadb",
"displayName": "[Deprecated] Diagnostic Settings for MariaDB to Log Analytics Workspace",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Monitoring",
"deprecated": true,
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.1.0-deprecated"
},
"mode": "Indexed",
"parameters": {
"effect": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
},
"logAnalytics": {
"metadata": {
"description": "Select Log Analytics workspace from dropdown list. If this workspace is outside of the scope of the assignment you must manually grant 'Log Analytics Contributor' permissions (or similar) to the policy assignment's principal ID.",
"displayName": "Log Analytics workspace",
"strongType": "omsWorkspace"
},
"type": "String"
},
"logsEnabled": {
"allowedValues": [
"True",
"False"
],
"defaultValue": "True",
"metadata": {
"description": "Whether to enable logs stream to the Log Analytics workspace - True or False",
"displayName": "Enable logs"
},
"type": "String"
},
"metricsEnabled": {
"allowedValues": [
"True",
"False"
],
"defaultValue": "True",
"metadata": {
"description": "Whether to enable metrics stream to the Log Analytics workspace - True or False",
"displayName": "Enable metrics"
},
"type": "String"
},
"profileName": {
"defaultValue": "setbypolicy",
"metadata": {
"description": "The diagnostic settings profile name",
"displayName": "Profile name"
},
"type": "String"
}
},
"policyRule": {
"if": {
"equals": "Microsoft.DBforMariaDB/servers",
"field": "type"
},
"then": {
"details": {
"deployment": {
"properties": {
"mode": "Incremental",
"parameters": {
"location": {
"value": "[field('location')]"
},
"logAnalytics": {
"value": "[parameters('logAnalytics')]"
},
"logsEnabled": {
"value": "[parameters('logsEnabled')]"
},
"metricsEnabled": {
"value": "[parameters('metricsEnabled')]"
},
"profileName": {
"value": "[parameters('profileName')]"
},
"resourceName": {
"value": "[field('name')]"
}
},
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"location": {
"type": "String"
},
"logAnalytics": {
"type": "String"
},
"logsEnabled": {
"type": "String"
},
"metricsEnabled": {
"type": "String"
},
"profileName": {
"type": "String"
},
"resourceName": {
"type": "String"
}
},
"resources": [
{
"apiVersion": "2017-05-01-preview",
"dependsOn": [],
"location": "[parameters('location')]",
"name": "[concat(parameters('resourceName'), '/', 'Microsoft.Insights/', parameters('profileName'))]",
"properties": {
"logs": [
{
"category": "MySqlSlowLogs",
"enabled": "[parameters('logsEnabled')]"
},
{
"category": "MySqlAuditLogs",
"enabled": "[parameters('logsEnabled')]"
}
],
"metrics": [
{
"category": "AllMetrics",
"enabled": "[parameters('metricsEnabled')]",
"retentionPolicy": {
"days": 0,
"enabled": false
},
"timeGrain": null
}
],
"workspaceId": "[parameters('logAnalytics')]"
},
"type": "Microsoft.DBforMariaDB/servers/providers/diagnosticSettings"
}
],
"variables": {}
}
}
},
"existenceCondition": {
"allOf": [
{
"equals": "true",
"field": "Microsoft.Insights/diagnosticSettings/logs.enabled"
},
{
"equals": "true",
"field": "Microsoft.Insights/diagnosticSettings/metrics.enabled"
},
{
"equals": "[parameters('logAnalytics')]",
"field": "Microsoft.Insights/diagnosticSettings/workspaceId"
}
]
},
"name": "[parameters('profileName')]",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/749f88d5-cbae-40b8-bcfc-e573ddc772fa",
"/providers/microsoft.authorization/roleDefinitions/92aaf0da-9dab-42b6-94a3-d43ce8d16293"
],
"type": "Microsoft.Insights/diagnosticSettings"
},
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}# Converted from Deploy-Diagnostics-MariaDB.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deploy-Diagnostics-MariaDB' {
Properties @{
DisplayName = '[Deprecated] Diagnostic Settings for MariaDB to Log Analytics Workspace'
Description = 'Deploys the diagnostic settings for MariaDB to stream to a Log Analytics workspace when any MariaDB which is missing this diagnostic settings is created or updated. The Policy will set the diagnostic with all metrics and category enabled. Deprecating due to service retirement, https://learn.microsoft.com/en-us/azure/mariadb/whats-happening-to-mariadb'
Category = 'Monitoring'
Deprecated = $true
Version = '1.1.0-deprecated'
Mode = 'Indexed'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter LogAnalytics @{
Type = 'String'
DisplayName = 'Log Analytics workspace'
Description = 'Select Log Analytics workspace from dropdown list. If this workspace is outside of the scope of the assignment you must manually grant ''Log Analytics Contributor'' permissions (or similar) to the policy assignment''s principal ID.'
Metadata = [ordered]@{ strongType = 'omsWorkspace' }
}
Parameter LogsEnabled @{
AllowedValues = @('True', 'False')
Default = 'True'
DisplayName = 'Enable logs'
Description = 'Whether to enable logs stream to the Log Analytics workspace - True or False'
}
Parameter MetricsEnabled @{
AllowedValues = @('True', 'False')
Default = 'True'
DisplayName = 'Enable metrics'
Description = 'Whether to enable metrics stream to the Log Analytics workspace - True or False'
}
Parameter ProfileName @{
Default = 'setbypolicy'
DisplayName = 'Profile name'
Description = 'The diagnostic settings profile name'
}
Resource 'Microsoft.DBforMariaDB/servers'
DeployIfNotExists 'Microsoft.Insights/diagnosticSettings' -Role 'Monitoring Contributor', 'Log Analytics Contributor' -Name (Param ProfileName) -Effect (Param Effect) {
Require 'logs.enabled is true, metrics.enabled is true and workspaceId is the LogAnalytics parameter' {
Field logs.enabled | Must -Be 'true'
Field metrics.enabled | Must -Be 'true'
Field workspaceId | Must -Be (Param LogAnalytics)
}
Deployment -TemplateFile './templates/Deploy-Diagnostics-MariaDB.json' -Parameters ([ordered]@{
location = (Arm '[field(''location'')]')
logAnalytics = (Param LogAnalytics)
logsEnabled = (Param LogsEnabled)
metricsEnabled = (Param MetricsEnabled)
profileName = (Param ProfileName)
resourceName = (Arm '[field(''name'')]')
})
}
}Its deployment templates are written beside it:
templates/Deploy-Diagnostics-MariaDB.json
Source: policy_definitions/Deploy-Diagnostics-MariaDB.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw