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.

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

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.

risk-label

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.

Review your Azure Monitor settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

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

azuredeploy.json#L17
      "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",
QueriesAlerts.json#L21
            "type":"Microsoft.Insights/scheduledQueryRules",
            "name":"Error and Critical Events",
            "apiVersion": "2018-04-16",
            "location": "[parameters('WorkspaceLocation')]",
            "properties":{
                "description": "Error and Critical Events",
arm-template.json#L48
      "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"
rule_template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "scheduledqueryrules_name": {
arm-mon-custom-alerts.json#L90
            "type": "Microsoft.Insights/scheduledQueryRules",
            "apiVersion": "2018-04-16",
            "location": "[resourceGroup().location]",
            "tags" : {
                "EnvironmentName": "[parameters('environmentName')]",
                "Branch":"[parameters('branch')]",
azure.com_monitor-scheduledQueryRule_API_2018-04-16.json#L181
                      "type": "Microsoft.Insights/scheduledQueryRules"
                    },
                    {
                      "id": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/scheduledQueryRules/logalertfoo",
                      "location": "West US",
                      "name": "logalertfoo",
alertsqlserversdatabases.json
{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "infrastructure": {
listScheduledQueryRules.json#L15
            "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": {
rule_template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "scheduledqueryrules_Metrics_name": {
listScheduledQueryRules.json#L15
            "type": "Microsoft.Insights/scheduledQueryRules",
            "location": "West US",
            "tags": { },
            "properties": {
              "description": "log alert description",
              "enabled": "false",

Frequently asked questions

What is Azure Monitor Scheduled Query Rules Log?

Azure Monitor Scheduled Query Rules Log is a resource for Monitor of Microsoft Azure. Settings can be wrote in Terraform.