Azure Monitor Scheduled Query Rules Log
This page shows how to write Terraform and Azure Resource Manager for Monitor Scheduled Query Rules Log and write them securely.
azurerm_monitor_scheduled_query_rules_log (Terraform)
The Scheduled Query Rules Log in Monitor can be configured in Terraform with the resource name azurerm_monitor_scheduled_query_rules_log
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
-
authorized_resource_ids
optional - set of string -
data_source_id
required - string -
description
optional - string -
enabled
optional - bool -
id
optional computed - string -
location
required - string -
name
required - string -
resource_group_name
required - string -
tags
optional - map from string to string -
criteria
list block-
metric_name
required - string -
dimension
set block
-
-
timeouts
single block
Explanation in Terraform Registry
Manages a LogToMetricAction Scheduled Query Rules resource within Azure Monitor.
Tips: Best Practices for The Other Azure Monitor Resources
In addition to the azurerm_monitor_log_profile, Azure Monitor has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_monitor_log_profile
Ensure to enable the activity retention log
It is better to enable the activity retention log to ensure that all the information required for an effective investigation is still available.
Microsoft.Insights/scheduledQueryRules (Azure Resource Manager)
The scheduledQueryRules in Microsoft.Insights can be configured in Azure Resource Manager with the resource name Microsoft.Insights/scheduledQueryRules
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Insights/scheduledQueryRules",
"apiVersion": "2018-04-16",
"location": "[parameters('location')]",
"name": "[ClientName]-AzureVM-CPU-Critical",
"properties": {
"description": "CPU is above 90% for listed VMs",
"type":"Microsoft.Insights/scheduledQueryRules",
"name":"Error and Critical Events",
"apiVersion": "2018-04-16",
"location": "[parameters('WorkspaceLocation')]",
"properties":{
"description": "Error and Critical Events",
"type": "Microsoft.Insights/scheduledQueryRules",
"name": "Exceptions",
"apiVersion": "2018-04-16",
"location": "[variables('northEuropeLocation')]",
"tags": {
"[concat('hidden-link:/subscriptions/a7b6f428-0ed2-4721-9548-d17c361d9b77/resourcegroups/', parameters('appName'), '/providers/microsoft.insights/components/', variables('insights'))]": "Resource"
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"scheduledqueryrules_name": {
"type": "Microsoft.Insights/scheduledQueryRules",
"apiVersion": "2018-04-16",
"location": "[resourceGroup().location]",
"tags" : {
"EnvironmentName": "[parameters('environmentName')]",
"Branch":"[parameters('branch')]",
"type": "Microsoft.Insights/scheduledQueryRules"
},
{
"id": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/scheduledQueryRules/logalertfoo",
"location": "West US",
"name": "logalertfoo",
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"infrastructure": {
"type": "Microsoft.Insights/scheduledQueryRules",
"location": "West US",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI": "Resource"
},
"properties": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"scheduledqueryrules_Metrics_name": {
"type": "Microsoft.Insights/scheduledQueryRules",
"location": "West US",
"tags": { },
"properties": {
"description": "log alert description",
"enabled": "false",