openapi: 3.1.0 info: title: Azure Monitor Scheduled Query Rules API description: >- Create and manage log search alert rules that automatically evaluate log queries at regular intervals and fire alerts when conditions are met. version: '2021-08-01' contact: name: Microsoft Azure Support url: https://azure.microsoft.com/en-us/support/options/ license: name: Microsoft API License url: https://azure.microsoft.com/en-us/support/legal/ servers: - url: https://management.azure.com description: Azure Resource Manager security: - oauth2: - https://management.azure.com/.default tags: - name: Scheduled Query Rules description: Operations for managing scheduled query-based alert rules paths: /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules: get: operationId: ScheduledQueryRules_ListBySubscription summary: Azure Monitor List scheduled query rules in a subscription description: >- Retrieve a list of all scheduled query rules defined within a subscription. tags: - Scheduled Query Rules parameters: - $ref: '#/components/parameters/SubscriptionIdParameter' - $ref: '#/components/parameters/ApiVersionParameter' responses: '200': description: Successful request for a list of scheduled query rules. content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResourceCollection' default: description: Error response describing why the operation failed. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules: get: operationId: ScheduledQueryRules_ListByResourceGroup summary: Azure Monitor List scheduled query rules in a resource group description: >- Retrieve a list of scheduled query rules within a resource group. tags: - Scheduled Query Rules parameters: - $ref: '#/components/parameters/SubscriptionIdParameter' - $ref: '#/components/parameters/ResourceGroupNameParameter' - $ref: '#/components/parameters/ApiVersionParameter' responses: '200': description: Successful request for a list of scheduled query rules. content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResourceCollection' default: description: Error response describing why the operation failed. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} : get: operationId: ScheduledQueryRules_Get summary: Azure Monitor Get a scheduled query rule description: >- Retrieve a scheduled query rule definition by name. tags: - Scheduled Query Rules parameters: - $ref: '#/components/parameters/SubscriptionIdParameter' - $ref: '#/components/parameters/ResourceGroupNameParameter' - $ref: '#/components/parameters/RuleNameParameter' - $ref: '#/components/parameters/ApiVersionParameter' responses: '200': description: Successful request to get a scheduled query rule. content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResource' default: description: Error response describing why the operation failed. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' put: operationId: ScheduledQueryRules_CreateOrUpdate summary: Azure Monitor Create or update a scheduled query rule description: >- Creates or updates a scheduled query rule. These rules evaluate log queries at defined intervals and trigger alerts when specified conditions are met. tags: - Scheduled Query Rules parameters: - $ref: '#/components/parameters/SubscriptionIdParameter' - $ref: '#/components/parameters/ResourceGroupNameParameter' - $ref: '#/components/parameters/RuleNameParameter' - $ref: '#/components/parameters/ApiVersionParameter' requestBody: description: The parameters of the scheduled query rule to create or update. required: true content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResource' responses: '200': description: Successful request to update a scheduled query rule. content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResource' '201': description: Created new scheduled query rule successfully. content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResource' default: description: Error response describing why the operation failed. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' patch: operationId: ScheduledQueryRules_Update summary: Azure Monitor Update a scheduled query rule description: >- Update a scheduled query rule. Allows partial updates to an existing rule. tags: - Scheduled Query Rules parameters: - $ref: '#/components/parameters/SubscriptionIdParameter' - $ref: '#/components/parameters/ResourceGroupNameParameter' - $ref: '#/components/parameters/RuleNameParameter' - $ref: '#/components/parameters/ApiVersionParameter' requestBody: description: The parameters to patch on the scheduled query rule. required: true content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResourcePatch' responses: '200': description: Successful request to update a scheduled query rule. content: application/json: schema: $ref: '#/components/schemas/ScheduledQueryRuleResource' default: description: Error response describing why the operation failed. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' delete: operationId: ScheduledQueryRules_Delete summary: Azure Monitor Delete a scheduled query rule description: >- Deletes a scheduled query rule from a resource group. tags: - Scheduled Query Rules parameters: - $ref: '#/components/parameters/SubscriptionIdParameter' - $ref: '#/components/parameters/ResourceGroupNameParameter' - $ref: '#/components/parameters/RuleNameParameter' - $ref: '#/components/parameters/ApiVersionParameter' responses: '200': description: Successful request to delete a scheduled query rule. '204': description: Resource does not exist. The request was still successful. default: description: Error response describing why the operation failed. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' components: securitySchemes: oauth2: type: oauth2 flows: clientCredentials: tokenUrl: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token scopes: https://management.azure.com/.default: Access Azure Management API parameters: SubscriptionIdParameter: name: subscriptionId in: path required: true description: The ID of the target subscription. schema: type: string ResourceGroupNameParameter: name: resourceGroupName in: path required: true description: The name of the resource group. schema: type: string RuleNameParameter: name: ruleName in: path required: true description: The name of the rule. schema: type: string ApiVersionParameter: name: api-version in: query required: true description: Client API version. schema: type: string default: '2021-08-01' schemas: ScheduledQueryRuleResource: type: object required: - location - properties properties: id: type: string readOnly: true description: Fully qualified resource ID. name: type: string readOnly: true description: The name of the resource. type: type: string readOnly: true description: The type of the resource. location: type: string description: The geo-location where the resource lives. tags: type: object additionalProperties: type: string description: Resource tags. kind: type: string enum: - LogAlert - LogToMetric description: >- Indicates the type of scheduled query rule. The default is LogAlert. etag: type: string readOnly: true description: The etag field is not required. systemData: $ref: '#/components/schemas/SystemData' properties: $ref: '#/components/schemas/ScheduledQueryRuleProperties' ScheduledQueryRuleProperties: type: object required: - severity - enabled - scopes - evaluationFrequency - windowSize - criteria properties: createdWithApiVersion: type: string readOnly: true description: The API version used when creating this alert rule. isLegacyLogAnalyticsRule: type: boolean readOnly: true description: True if this alert rule is a legacy Log Analytics rule. description: type: string description: The description of the scheduled query rule. displayName: type: string description: The display name of the alert rule. severity: type: integer format: int64 enum: - 0 - 1 - 2 - 3 - 4 description: >- Severity of the alert. Should be an integer between 0-4. Value of 0 is severest. enabled: type: boolean description: >- The flag that indicates whether this scheduled query rule is enabled. scopes: type: array items: type: string description: The list of resource IDs that this scheduled query rule is scoped to. evaluationFrequency: type: string description: >- How often the scheduled query rule is evaluated in ISO 8601 duration format. windowSize: type: string description: >- The period of time in ISO 8601 duration format on which the alert rule will be executed. overrideQueryTimeRange: type: string description: >- If specified, overrides the query time range. targetResourceTypes: type: array items: type: string description: >- List of resource type of the target resources on which the alert is created. criteria: $ref: '#/components/schemas/ScheduledQueryRuleCriteria' muteActionsDuration: type: string description: >- Mute actions for the chosen period of time in ISO 8601 duration format. actions: $ref: '#/components/schemas/Actions' isWorkspaceAlertsStorageConfigured: type: boolean readOnly: true description: >- The flag that indicates whether this scheduled query rule has been configured to be stored in the customer's storage. checkWorkspaceAlertsStorageConfigured: type: boolean description: >- The flag that indicates whether this scheduled query rule should be stored in the customer's storage. skipQueryValidation: type: boolean description: >- The flag that indicates whether the provided query should be validated. autoMitigate: type: boolean description: >- The flag that indicates whether the alert should be automatically resolved. ScheduledQueryRuleCriteria: type: object properties: allOf: type: array items: $ref: '#/components/schemas/Condition' description: A list of conditions to evaluate against the specified scopes. Condition: type: object properties: query: type: string description: Log query alert query. timeAggregation: type: string enum: - Count - Average - Minimum - Maximum - Total description: Aggregation type. metricMeasureColumn: type: string description: The column containing the metric measure number. resourceIdColumn: type: string description: The column containing the resource ID. dimensions: type: array items: $ref: '#/components/schemas/Dimension' description: List of dimension conditions. operator: type: string enum: - Equals - GreaterThan - GreaterThanOrEqual - LessThan - LessThanOrEqual description: The criteria operator. threshold: type: number format: double description: The criteria threshold value that activates the alert. failingPeriods: type: object properties: numberOfEvaluationPeriods: type: integer format: int64 description: >- The number of aggregated lookback points. default: 1 minFailingPeriodsToAlert: type: integer format: int64 description: >- The number of violations to trigger an alert. default: 1 description: >- The minimum number of violations required within the selected lookback time window. metricName: type: string description: The name of the metric to be sent. Dimension: type: object required: - name - operator - values properties: name: type: string description: Name of the dimension. operator: type: string enum: - Include - Exclude description: Operator for dimension values. values: type: array items: type: string description: List of dimension values. Actions: type: object properties: actionGroups: type: array items: type: string description: Action Group resource IDs to invoke when the alert fires. customProperties: type: object additionalProperties: type: string description: >- The properties of an alert payload. SystemData: type: object properties: createdBy: type: string description: The identity that created the resource. createdByType: type: string enum: - User - Application - ManagedIdentity - Key description: The type of identity that created the resource. createdAt: type: string format: date-time description: The timestamp of resource creation. lastModifiedBy: type: string description: The identity that last modified the resource. lastModifiedByType: type: string enum: - User - Application - ManagedIdentity - Key description: The type of identity that last modified the resource. lastModifiedAt: type: string format: date-time description: The timestamp of resource last modification. ScheduledQueryRuleResourcePatch: type: object properties: tags: type: object additionalProperties: type: string description: Resource tags. properties: $ref: '#/components/schemas/ScheduledQueryRuleProperties' ScheduledQueryRuleResourceCollection: type: object properties: value: type: array items: $ref: '#/components/schemas/ScheduledQueryRuleResource' description: The values for the scheduled query rules. nextLink: type: string description: Link to retrieve next set of results. ErrorResponse: type: object properties: code: type: string description: Error code. message: type: string description: Error message indicating why the operation failed.