Azure Monitor Alert Rules API

Operations for managing classic metric alert rules

Documentation

📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/metrics
📖
Authentication
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/metrics-batch
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/loganalytics/
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/api/overview
📖
Documentation
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-ingestion-api-overview
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-logs-ingestion-api
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/alertrules
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/scheduledqueryrule-2021-08-01/scheduled-query-rules
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/action-groups
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/autoscale-settings
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/autoscale/autoscale-best-practices
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/application-insights/
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/diagnostic-settings
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/activity-logs
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-rules
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/data-collection/data-collection-rule-create-edit
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-endpoints
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/data-collection/data-collection-endpoint-overview
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/private-link-scopes
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/private-link-configure

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

microsoft-azure-monitor-alert-rules-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Azure Monitor Action Groups Alert Rules API
  description: Create and manage action groups that define notification and automation actions triggered by Azure Monitor alerts, including email, SMS, webhooks, and Azure Functions.
  version: '2022-06-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: Alert Rules
  description: Operations for managing classic metric alert rules
paths:
  /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}:
    put:
      operationId: AlertRules_CreateOrUpdate
      summary: Azure Monitor Create or update a classic metric alert rule
      description: Creates or updates a classic metric alert rule. Classic alert rules evaluate metrics at regular intervals and trigger actions when conditions are met.
      tags:
      - Alert Rules
      parameters:
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/RuleNameParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      requestBody:
        description: The parameters of the rule to create or update.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertRuleResource'
      responses:
        '200':
          description: Successful request to update an alert rule.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRuleResource'
        '201':
          description: Created new alert rule successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRuleResource'
        default:
          description: Error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    get:
      operationId: AlertRules_Get
      summary: Azure Monitor Get a classic metric alert rule
      description: Gets a classic metric alert rule by name from a specified resource group.
      tags:
      - Alert Rules
      parameters:
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/RuleNameParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successful request to get an alert rule.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRuleResource'
        default:
          description: Error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    delete:
      operationId: AlertRules_Delete
      summary: Azure Monitor Delete a classic metric alert rule
      description: Deletes a classic metric alert rule from a specified resource group.
      tags:
      - Alert Rules
      parameters:
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/RuleNameParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successful request to delete an alert rule.
        '204':
          description: Alert rule 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'
    patch:
      operationId: AlertRules_Update
      summary: Azure Monitor Update a classic metric alert rule
      description: Updates an existing classic metric alert rule. This can be used to update tags on the rule resource.
      tags:
      - Alert Rules
      parameters:
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/RuleNameParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      requestBody:
        description: Parameters supplied to the operation.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertRuleResourcePatch'
      responses:
        '200':
          description: Successful request to update an alert rule.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRuleResource'
        default:
          description: Error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules:
    get:
      operationId: AlertRules_ListByResourceGroup
      summary: Azure Monitor List classic alert rules in a resource group
      description: Lists the classic metric alert rules within a resource group.
      tags:
      - Alert Rules
      parameters:
      - $ref: '#/components/parameters/ResourceGroupNameParameter'
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successful request for a list of alert rules.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRuleResourceCollection'
        default:
          description: Error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules:
    get:
      operationId: AlertRules_ListBySubscription
      summary: Azure Monitor List classic alert rules in a subscription
      description: Lists the classic metric alert rules within a subscription.
      tags:
      - Alert Rules
      parameters:
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      responses:
        '200':
          description: Successful request for a list of alert rules.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRuleResourceCollection'
        default:
          description: Error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    ApiVersionParameter:
      name: api-version
      in: query
      required: true
      description: Client API version.
      schema:
        type: string
        default: '2016-03-01'
    ResourceGroupNameParameter:
      name: resourceGroupName
      in: path
      required: true
      description: The name of the resource group.
      schema:
        type: string
    SubscriptionIdParameter:
      name: subscriptionId
      in: path
      required: true
      description: The ID of the target subscription.
      schema:
        type: string
    RuleNameParameter:
      name: ruleName
      in: path
      required: true
      description: The name of the rule.
      schema:
        type: string
  schemas:
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code.
        message:
          type: string
          description: Error message indicating why the operation failed.
    AlertRuleResourcePatch:
      type: object
      properties:
        tags:
          type: object
          additionalProperties:
            type: string
          description: Resource tags.
        properties:
          $ref: '#/components/schemas/AlertRule'
    RuleDataSource:
      type: object
      required:
      - odata.type
      properties:
        odata.type:
          type: string
          description: Specifies the type of data source. Possible values include RuleMetricDataSource, RuleManagementEventDataSource.
        resourceUri:
          type: string
          description: The resource identifier of the resource the rule monitors.
        legacyResourceId:
          type: string
          description: The legacy resource identifier of the resource the rule monitors.
        resourceLocation:
          type: string
          description: The location of the resource.
        metricNamespace:
          type: string
          description: The namespace of the metric.
    RuleAction:
      type: object
      required:
      - odata.type
      properties:
        odata.type:
          type: string
          description: Specifies the type of action. Possible values include RuleEmailAction and RuleWebhookAction.
    AlertRuleResource:
      type: object
      required:
      - location
      - properties
      properties:
        id:
          type: string
          readOnly: true
          description: Azure resource ID.
        name:
          type: string
          readOnly: true
          description: Azure resource name.
        type:
          type: string
          readOnly: true
          description: Azure resource type.
        location:
          type: string
          description: Resource location.
        tags:
          type: object
          additionalProperties:
            type: string
          description: Resource tags.
        properties:
          $ref: '#/components/schemas/AlertRule'
    AlertRule:
      type: object
      required:
      - name
      - isEnabled
      - condition
      properties:
        name:
          type: string
          description: The name of the alert rule.
        description:
          type: string
          description: The description of the alert rule.
        provisioningState:
          type: string
          description: The provisioning state.
        isEnabled:
          type: boolean
          description: The flag that indicates whether the alert rule is enabled.
        condition:
          $ref: '#/components/schemas/RuleCondition'
        lastUpdatedTime:
          type: string
          format: date-time
          readOnly: true
          description: Last time the rule was updated in ISO 8601 format.
        actions:
          type: array
          items:
            $ref: '#/components/schemas/RuleAction'
          description: The array of actions that are performed when the alert rule becomes active.
    AlertRuleResourceCollection:
      type: object
      properties:
        value:
          type: array
          items:
            $ref: '#/components/schemas/AlertRuleResource'
          description: The values for the alert rule resources.
    RuleCondition:
      type: object
      required:
      - odata.type
      properties:
        odata.type:
          type: string
          description: Specifies the type of condition. Possible values include ThresholdRuleCondition, LocationThresholdRuleCondition, ManagementEventRuleCondition.
        dataSource:
          $ref: '#/components/schemas/RuleDataSource'
  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