microsoft.insights scheduledQueryRules template reference

Template format

To create a microsoft.insights/scheduledQueryRules resource, add the following JSON to the resources section of your template.

  "name": "string",
  "type": "microsoft.insights/scheduledQueryRules",
  "apiVersion": "2018-04-16",
  "location": "string",
  "tags": {},
  "properties": {
    "description": "string",
    "enabled": "string",
    "source": {
      "query": "string",
      "authorizedResources": [
      "dataSourceId": "string",
      "queryType": "ResultCount"
    "schedule": {
      "frequencyInMinutes": "integer",
      "timeWindowInMinutes": "integer"
    "action": {
      "odata.type": "string"

Property values

The following tables describe the values you need to set in the schema.

microsoft.insights/scheduledQueryRules object

Name Type Required Value
name string Yes The name of the rule.
type enum Yes microsoft.insights/scheduledQueryRules
apiVersion enum Yes 2018-04-16
location string Yes Resource location
tags object No Resource tags
properties object Yes The rule properties of the resource. - LogSearchRule object

LogSearchRule object

Name Type Required Value
description string No The description of the Log Search rule.
enabled enum No The flag which indicates whether the Log Search rule is enabled. Value should be true or false. - true or false
source object Yes Data Source against which rule will Query Data - Source object
schedule object No Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction - Schedule object
action object Yes Action needs to be taken on rule execution. - Action object

Source object

Name Type Required Value
query string No Log search query. Required for action type - AlertingAction
authorizedResources array No List of Resource referred into query - string
dataSourceId string Yes The resource uri over which log search query is to be run.
queryType enum No Set value to 'ResultCount'. - ResultCount

Schedule object

Name Type Required Value
frequencyInMinutes integer Yes frequency (in minutes) at which rule condition should be evaluated.
timeWindowInMinutes integer Yes Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).

Action object

Name Type Required Value
odata.type string Yes