swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Azure Monitor client to create/update/delete metric based alerts.
  title: MonitorManagementClient
  version: 2018-03-01
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-ms-code-generation-settings:
    name: MonitorManagementClient
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/metricAlert_API.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: monitor-metricAlert_API
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters:
  ApiVersionParameter:
    description: Client Api Version.
    in: query
    name: api-version
    required: true
    type: string
  ResourceGroupNameParameter:
    description: The name of the resource group.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  RuleNameParameter:
    description: The name of the rule.
    in: path
    name: ruleName
    required: true
    type: string
    x-ms-parameter-location: method
  StatusNameParameter:
    description: The name of the status.
    in: path
    name: statusName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The Azure subscription Id.
    in: path
    name: subscriptionId
    required: true
    type: string
paths:
  "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts":
    get:
      description: Retrieve alert rule definitions in a subscription.
      operationId: MetricAlerts_ListBySubscription
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request for a list of metric alerts
          schema:
            $ref: "#/definitions/MetricAlertResourceCollection"
        default:
          description: BadRequest
          schema:
            description: Describes the format of Error response.
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - MetricAlerts
      x-ms-examples:
        List metric alert rules:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/highcpu
                    location: global
                    properties:
                      actions:
                        - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                          webhookProperties:
                            key11: value11
                            key12: value12
                      criteria:
                        allOf:
                          - criterionType: StaticThresholdCriterion
                            dimensions: []
                            metricName: CustomMetric_\Processor(_Total)\% Processor Time
                            name: High_CPU_80
                            operator: GreaterThan
                            threshold: 80.5
                            timeAggregation: Average
                        odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                      description: This is the description of the rule1
                      enabled: true
                      evaluationFrequency: Pt1m
                      scopes:
                        - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                      severity: 3
                      windowSize: Pt15m
                    tags:
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/metricAlerts
                  - id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/mediumcpu
                    location: global
                    properties:
                      actions:
                        - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                          webhookProperties:
                            key11: value11
                            key12: value12
                      criteria:
                        allOf:
                          - criterionType: StaticThresholdCriterion
                            dimensions: []
                            metricName: CustomMetric_\Processor(_Total)\% Processor Time
                            name: Medium_CPU_50
                            operator: GreaterThan
                            threshold: 50.5
                            timeAggregation: Average
                        odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                      description: Med cpu alert
                      enabled: true
                      evaluationFrequency: Pt1m
                      scopes:
                        - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                      severity: 4
                      windowSize: Pt15m
                    tags:
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/metricAlerts
              headers: {}
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts":
    get:
      description: Retrieve alert rule definitions in a resource group.
      operationId: MetricAlerts_ListByResourceGroup
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request for a list of metric alerts
          schema:
            $ref: "#/definitions/MetricAlertResourceCollection"
        default:
          description: BadRequest
          schema:
            description: Describes the format of Error response.
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - MetricAlerts
      x-ms-examples:
        List metric alert rules:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/highcpu
                    location: global
                    properties:
                      actions:
                        - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                          webhookProperties:
                            key11: value11
                            key12: value12
                      criteria:
                        allOf:
                          - criterionType: StaticThresholdCriterion
                            dimensions: []
                            metricName: CustomMetric_\Processor(_Total)\% Processor Time
                            name: High_CPU_80
                            operator: GreaterThan
                            threshold: 80.5
                            timeAggregation: Average
                        odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                      description: This is the description of the rule1
                      enabled: true
                      evaluationFrequency: Pt1m
                      scopes:
                        - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                      severity: 3
                      windowSize: Pt15m
                    tags:
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/metricAlerts
                  - id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/mediumcpu
                    location: global
                    properties:
                      actions:
                        - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                          webhookProperties:
                            key11: value11
                            key12: value12
                      criteria:
                        allOf:
                          - criterionType: StaticThresholdCriterion
                            dimensions: []
                            metricName: CustomMetric_\Processor(_Total)\% Processor Time
                            name: Medium_CPU_50
                            operator: GreaterThan
                            threshold: 50.5
                            timeAggregation: Average
                        odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                      description: Med cpu alert
                      enabled: true
                      evaluationFrequency: Pt1m
                      scopes:
                        - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                      severity: 4
                      windowSize: Pt15m
                    tags:
                      hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                    type: Microsoft.Insights/metricAlerts
              headers: {}
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}":
    delete:
      description: Delete an alert rule definition.
      operationId: MetricAlerts_Delete
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request to delete an metric alert rule
        "204":
          description: "No content: the request was successful, but the response is empty"
      tags:
        - MetricAlerts
      x-ms-examples:
        Delete an alert rule:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            ruleName: chiricutin
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200": {}
            "204": {}
    get:
      description: Retrieve an alert rule definition.
      operationId: MetricAlerts_Get
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request for a list of metric alerts
          schema:
            $ref: "#/definitions/MetricAlertResource"
        default:
          description: BadRequest
          schema:
            description: Describes the format of Error response.
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - MetricAlerts
      x-ms-examples:
        Get a dynamic alert rule for multiple resources:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            ruleName: MetricAlertOnMultipleResources
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                id: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - alertSensitivity: Medium
                        criterionType: DynamicThresholdCriterion
                        dimensions: []
                        failingPeriods:
                          minFailingPeriodsToAlert: 4
                          numberOfEvaluationPeriods: 4
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterOrLessThan
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1
                    - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Get a dynamic alert rule for single resource:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            ruleName: chiricutin
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                id: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - alertSensitivity: Medium
                        criterionType: DynamicThresholdCriterion
                        dimensions: []
                        failingPeriods:
                          minFailingPeriodsToAlert: 4
                          numberOfEvaluationPeriods: 4
                        ignoreDataBefore: null
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterOrLessThan
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: Pt1m
                  scopes:
                    - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                  severity: 3
                  windowSize: Pt15m
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Get an alert rule for multiple resources:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            ruleName: MetricAlertOnMultipleResources
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Get an alert rule for single resource:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            ruleName: chiricutin
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: \Processor(_Total)\% Processor Time
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: Pt1m
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                  severity: 3
                  windowSize: Pt15m
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Get an alert rule on resource group(s):
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest1
            ruleName: MetricAlertAtResourceGroupLevel
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Get an alert rule on subscription:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            ruleName: MetricAlertAtSubscriptionLevel
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
    patch:
      description: Update an metric alert definition.
      operationId: MetricAlerts_Update
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The parameters of the rule to update.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/MetricAlertResourcePatch"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/MetricAlertResource"
        default:
          description: BadRequest
          schema:
            description: Describes the format of Error response.
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - MetricAlerts
      x-ms-examples:
        Create or update an alert rule:
          parameters:
            api-version: 2018-03-01
            parameters:
              properties:
                actions:
                  - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                    webhookProperties:
                      key11: value11
                      key12: value12
                autoMitigate: false
                criteria:
                  allOf:
                    - criterionType: StaticThresholdCriterion
                      dimensions: []
                      metricName: \Processor(_Total)\% Processor Time
                      name: High_CPU_80
                      operator: GreaterThan
                      threshold: 80.5
                      timeAggregation: Average
                  odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                description: This is the description of the rule1
                enabled: true
                evaluationFrequency: Pt1m
                scopes:
                  - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                severity: 3
                windowSize: Pt15m
              tags: {}
            resourceGroupName: gigtest
            ruleName: chiricutin
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: \Processor(_Total)\% Processor Time
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: Pt1m
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                  severity: 3
                  windowSize: Pt15m
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
    put:
      description: Create or update an metric alert definition.
      operationId: MetricAlerts_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The parameters of the rule to create or update.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/MetricAlertResource"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/MetricAlertResource"
        default:
          description: BadRequest
          schema:
            description: Describes the format of Error response.
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - MetricAlerts
      x-ms-examples:
        Create or update a dynamic alert rule for Multiple Resources:
          parameters:
            api-version: 2018-03-01
            parameters:
              location: global
              properties:
                actions:
                  - actionGroupId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                    webhookProperties:
                      key11: value11
                      key12: value12
                autoMitigate: false
                criteria:
                  allOf:
                    - alertSensitivity: Medium
                      criterionType: DynamicThresholdCriterion
                      dimensions: []
                      failingPeriods:
                        minFailingPeriodsToAlert: 4
                        numberOfEvaluationPeriods: 4
                      metricName: Percentage CPU
                      metricNamespace: microsoft.compute/virtualmachines
                      name: High_CPU_80
                      operator: GreaterOrLessThan
                      timeAggregation: Average
                  odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                description: This is the description of the rule1
                enabled: true
                evaluationFrequency: PT1M
                scopes:
                  - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1
                  - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2
                severity: 3
                targetResourceRegion: southcentralus
                targetResourceType: Microsoft.Compute/virtualMachines
                windowSize: PT15M
              tags: {}
            resourceGroupName: gigtest
            ruleName: MetricAlertOnMultipleResources
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                id: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - alertSensitivity: Medium
                        criterionType: DynamicThresholdCriterion
                        dimensions: []
                        failingPeriods:
                          minFailingPeriodsToAlert: 4
                          numberOfEvaluationPeriods: 4
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterOrLessThan
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1
                    - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Create or update a dynamic alert rule for Single Resource:
          parameters:
            api-version: 2018-03-01
            parameters:
              location: global
              properties:
                actions:
                  - actionGroupId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                    webhookProperties:
                      key11: value11
                      key12: value12
                autoMitigate: false
                criteria:
                  allOf:
                    - alertSensitivity: Medium
                      criterionType: DynamicThresholdCriterion
                      dimensions: []
                      failingPeriods:
                        minFailingPeriodsToAlert: 4
                        numberOfEvaluationPeriods: 4
                      ignoreDataBefore: 2019-04-04T21:00:00.000Z
                      metricName: Percentage CPU
                      metricNamespace: microsoft.compute/virtualmachines
                      name: High_CPU_80
                      operator: GreaterOrLessThan
                      timeAggregation: Average
                  odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                description: This is the description of the rule1
                enabled: true
                evaluationFrequency: PT1M
                scopes:
                  - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                severity: 3
                targetResourceRegion: southcentralus
                targetResourceType: Microsoft.Compute/virtualMachines
                windowSize: PT15M
              tags: {}
            resourceGroupName: gigtest
            ruleName: chiricutin
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                id: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - alertSensitivity: Medium
                        criterionType: DynamicThresholdCriterion
                        dimensions: []
                        failingPeriods:
                          minFailingPeriodsToAlert: 4
                          numberOfEvaluationPeriods: 4
                        ignoreDataBefore: 2019-04-04T21:00:00.000Z
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterOrLessThan
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Create or update an alert rule for Multiple Resource:
          parameters:
            api-version: 2018-03-01
            parameters:
              location: global
              properties:
                actions:
                  - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                    webhookProperties:
                      key11: value11
                      key12: value12
                autoMitigate: false
                criteria:
                  allOf:
                    - criterionType: StaticThresholdCriterion
                      dimensions: []
                      metricName: Percentage CPU
                      metricNamespace: microsoft.compute/virtualmachines
                      name: High_CPU_80
                      operator: GreaterThan
                      threshold: 80.5
                      timeAggregation: Average
                  odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                description: This is the description of the rule1
                enabled: true
                evaluationFrequency: PT1M
                scopes:
                  - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1
                  - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2
                severity: 3
                targetResourceRegion: southcentralus
                targetResourceType: Microsoft.Compute/virtualMachines
                windowSize: PT15M
              tags: {}
            resourceGroupName: gigtest
            ruleName: MetricAlertOnMultipleResources
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Create or update an alert rule for Single Resource:
          parameters:
            api-version: 2018-03-01
            parameters:
              location: global
              properties:
                actions:
                  - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                    webhookProperties:
                      key11: value11
                      key12: value12
                autoMitigate: false
                criteria:
                  allOf:
                    - criterionType: StaticThresholdCriterion
                      dimensions: []
                      metricName: \Processor(_Total)\% Processor Time
                      name: High_CPU_80
                      operator: GreaterThan
                      threshold: 80.5
                      timeAggregation: Average
                  odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                description: This is the description of the rule1
                enabled: true
                evaluationFrequency: Pt1m
                scopes:
                  - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                severity: 3
                windowSize: Pt15m
              tags: {}
            resourceGroupName: gigtest
            ruleName: chiricutin
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: \Processor(_Total)\% Processor Time
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: Pt1m
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                  severity: 3
                  windowSize: Pt15m
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        Create or update an alert rule on Resource group(s):
          parameters:
            api-version: 2018-03-01
            parameters:
              location: global
              properties:
                actions:
                  - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                    webhookProperties:
                      key11: value11
                      key12: value12
                autoMitigate: false
                criteria:
                  allOf:
                    - criterionType: StaticThresholdCriterion
                      dimensions: []
                      metricName: Percentage CPU
                      metricNamespace: microsoft.compute/virtualmachines
                      name: High_CPU_80
                      operator: GreaterThan
                      threshold: 80.5
                      timeAggregation: Average
                  odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                description: This is the description of the rule1
                enabled: true
                evaluationFrequency: PT1M
                scopes:
                  - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1
                  - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2
                severity: 3
                targetResourceRegion: southcentralus
                targetResourceType: Microsoft.Compute/virtualMachines
                windowSize: PT15M
              tags: {}
            resourceGroupName: gigtest1
            ruleName: MetricAlertAtResourceGroupLevel
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
        "Create or update an alert rule on Subscription ":
          parameters:
            api-version: 2018-03-01
            parameters:
              location: global
              properties:
                actions:
                  - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                    webhookProperties:
                      key11: value11
                      key12: value12
                autoMitigate: false
                criteria:
                  allOf:
                    - criterionType: StaticThresholdCriterion
                      dimensions: []
                      metricName: Percentage CPU
                      metricNamespace: microsoft.compute/virtualmachines
                      name: High_CPU_80
                      operator: GreaterThan
                      threshold: 80.5
                      timeAggregation: Average
                  odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                description: This is the description of the rule1
                enabled: true
                evaluationFrequency: PT1M
                scopes:
                  - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
                severity: 3
                targetResourceRegion: southcentralus
                targetResourceType: Microsoft.Compute/virtualMachines
                windowSize: PT15M
              tags: {}
            resourceGroupName: gigtest
            ruleName: MetricAlertAtSubscriptionLevel
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                id: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel
                location: global
                properties:
                  actions:
                    - actionGroupId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/notificationgroups/group2
                      webhookProperties:
                        key11: value11
                        key12: value12
                  autoMitigate: false
                  criteria:
                    allOf:
                      - criterionType: StaticThresholdCriterion
                        dimensions: []
                        metricName: Percentage CPU
                        metricNamespace: microsoft.compute/virtualmachines
                        name: High_CPU_80
                        operator: GreaterThan
                        threshold: 80.5
                        timeAggregation: Average
                    odata.type: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
                  description: This is the description of the rule1
                  enabled: true
                  evaluationFrequency: PT1M
                  scopes:
                    - /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
                  severity: 3
                  targetResourceRegion: southcentralus
                  targetResourceType: Microsoft.Compute/virtualMachines
                  windowSize: PT15M
                tags:
                  hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest: Resource
                type: Microsoft.Insights/metricAlerts
              headers: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status":
    get:
      description: Retrieve an alert rule status.
      operationId: MetricAlertsStatus_List
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request for a list of metric alerts
          schema:
            $ref: "#/definitions/MetricAlertStatusCollection"
        default:
          description: BadRequest
          schema:
            description: Describes the format of Error response.
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - MetricAlertsStatus
      x-ms-examples:
        Get an alert rule status:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: gigtest
            ruleName: chiricutin
            subscriptionId: 14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/LeoAlert_custom1
                    name: cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l
                    properties:
                      dimensions:
                        resourceId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                      status: Healthy
                      timestamp: 2018-01-17T20:17:25.6293237Z
                    type: Microsoft.Insights/metricAlerts/status
              headers: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}":
    get:
      description: Retrieve an alert rule status.
      operationId: MetricAlertsStatus_ListByName
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/RuleNameParameter"
        - $ref: "#/parameters/StatusNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successful request for a list of metric alerts
          schema:
            $ref: "#/definitions/MetricAlertStatusCollection"
        default:
          description: BadRequest
          schema:
            description: Describes the format of Error response.
            properties:
              code:
                description: Error code
                type: string
              message:
                description: Error message indicating why the operation failed.
                type: string
            type: object
      tags:
        - MetricAlertsStatus
      x-ms-examples:
        Get an alert rule status:
          parameters:
            api-version: 2018-03-01
            resourceGroupName: EastUs
            ruleName: custom1
            statusName: cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l
            subscriptionId: 009f6022-67ec-423e-9aa7-691182870588
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/custom1
                    name: cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l
                    properties:
                      dimensions:
                        resourceId: /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme
                      status: Healthy
                      timestamp: 2018-01-17T20:17:25.6293237Z
                    type: Microsoft.Insights/metricAlerts/status
              headers: {}
definitions:
  DynamicMetricCriteria:
    allOf:
      - $ref: "#/definitions/MultiMetricCriteria"
    description: Criterion for dynamic threshold.
    properties:
      alertSensitivity:
        description: The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern.
        enum:
          - Low
          - Medium
          - High
        x-ms-enum:
          modelAsString: true
          name: DynamicThresholdSensitivity
      failingPeriods:
        $ref: "#/definitions/DynamicThresholdFailingPeriods"
        description: The minimum number of violations required within the selected lookback time window required to raise an alert.
        type: object
      ignoreDataBefore:
        description: Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format)
        format: date-time
        type: string
      operator:
        description: The operator used to compare the metric value against the threshold.
        enum:
          - GreaterThan
          - LessThan
          - GreaterOrLessThan
        x-ms-enum:
          modelAsString: true
          name: DynamicThresholdOperator
    required:
      - operator
      - alertSensitivity
      - failingPeriods
    type: object
    x-ms-discriminator-value: DynamicThresholdCriterion
  DynamicThresholdFailingPeriods:
    description: The minimum number of violations required within the selected lookback time window required to raise an alert.
    properties:
      minFailingPeriodsToAlert:
        description: The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods.
        type: number
      numberOfEvaluationPeriods:
        description: The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points.
        type: number
    required:
      - numberOfEvaluationPeriods
      - minFailingPeriodsToAlert
  MetricAlertAction:
    description: An alert action.
    properties:
      actionGroupId:
        description: the id of the action group to use.
        type: string
      webhookProperties:
        additionalProperties:
          description: the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload.
          type: string
        description: The properties of a webhook object.
        type: object
  MetricAlertCriteria:
    additionalProperties:
      type: object
    description: The rule criteria that defines the conditions of the alert rule.
    discriminator: odata.type
    properties:
      odata.type:
        description: specifies the type of the alert criteria.
        enum:
          - Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
          - Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
        x-ms-enum:
          modelAsString: true
          name: odatatype
    required:
      - odata.type
    type: object
  MetricAlertMultipleResourceMultipleMetricCriteria:
    allOf:
      - $ref: "#/definitions/MetricAlertCriteria"
    description: Specifies the metric alert criteria for multiple resource that has multiple metric criteria.
    properties:
      allOf:
        description: "the list of multiple metric criteria for this 'all of' operation. "
        items:
          $ref: "#/definitions/MultiMetricCriteria"
        type: array
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
  MetricAlertProperties:
    description: An alert rule.
    properties:
      actions:
        description: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
        items:
          $ref: "#/definitions/MetricAlertAction"
        type: array
      autoMitigate:
        description: the flag that indicates whether the alert should be auto resolved or not.
        type: boolean
      criteria:
        $ref: "#/definitions/MetricAlertCriteria"
        description: defines the specific alert criteria information.
      description:
        description: the description of the metric alert that will be included in the alert email.
        type: string
      enabled:
        description: the flag that indicates whether the metric alert is enabled.
        type: boolean
      evaluationFrequency:
        description: how often the metric alert is evaluated represented in ISO 8601 duration format.
        format: duration
        type: string
      lastUpdatedTime:
        description: Last time the rule was updated in ISO8601 format.
        format: date-time
        readOnly: true
        type: string
      scopes:
        description: the list of resource id's that this metric alert is scoped to.
        items:
          type: string
        type: array
      severity:
        description: Alert severity {0, 1, 2, 3, 4}
        type: integer
      targetResourceRegion:
        description: the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
        type: string
      targetResourceType:
        description: the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.
        type: string
      windowSize:
        description: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.
        format: duration
        type: string
    required:
      - enabled
      - description
      - severity
      - evaluationFrequency
      - windowSize
      - criteria
  MetricAlertResource:
    allOf:
      - $ref: "#/definitions/Resource"
    description: The metric alert resource.
    properties:
      properties:
        $ref: "#/definitions/MetricAlertProperties"
        description: The alert rule properties of the resource.
        x-ms-client-flatten: true
    required:
      - properties
    type: object
  MetricAlertResourceCollection:
    description: Represents a collection of alert rule resources.
    properties:
      value:
        description: the values for the alert rule resources.
        items:
          $ref: "#/definitions/MetricAlertResource"
        type: array
  MetricAlertResourcePatch:
    description: The metric alert resource for patch operations.
    properties:
      properties:
        $ref: "#/definitions/MetricAlertProperties"
        description: The alert rule properties of the resource.
        x-ms-client-flatten: true
      tags:
        additionalProperties:
          type: string
        description: Resource tags
  MetricAlertSingleResourceMultipleMetricCriteria:
    allOf:
      - $ref: "#/definitions/MetricAlertCriteria"
    description: Specifies the metric alert criteria for a single resource that has multiple metric criteria.
    properties:
      allOf:
        description: "The list of metric criteria for this 'all of' operation. "
        items:
          $ref: "#/definitions/MetricCriteria"
        type: array
    type: object
    x-ms-discriminator-value: Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
  MetricAlertStatus:
    description: An alert status.
    properties:
      id:
        description: The alert rule arm id.
        type: string
      name:
        description: The status name.
        type: string
      properties:
        $ref: "#/definitions/MetricAlertStatusProperties"
        description: The alert status properties of the metric alert status.
        x-ms-client-flatten: false
      type:
        description: The extended resource type name.
        type: string
  MetricAlertStatusCollection:
    description: Represents a collection of alert rule resources.
    properties:
      value:
        description: the values for the alert rule resources.
        items:
          $ref: "#/definitions/MetricAlertStatus"
        type: array
  MetricAlertStatusProperties:
    description: An alert status properties.
    properties:
      dimensions:
        additionalProperties:
          type: string
        description: An object describing the type of the dimensions.
        type: object
      status:
        description: status value
        type: string
      timestamp:
        description: UTC time when the status was checked.
        format: date-time
        type: string
  MetricCriteria:
    allOf:
      - $ref: "#/definitions/MultiMetricCriteria"
    description: Criterion to filter metrics.
    properties:
      operator:
        description: the criteria operator.
        enum:
          - Equals
          - NotEquals
          - GreaterThan
          - GreaterThanOrEqual
          - LessThan
          - LessThanOrEqual
        x-ms-enum:
          modelAsString: true
          name: Operator
      threshold:
        description: the criteria threshold value that activates the alert.
        format: double
        type: number
    required:
      - operator
      - threshold
    type: object
    x-ms-discriminator-value: StaticThresholdCriterion
  MetricDimension:
    description: Specifies a metric dimension.
    properties:
      name:
        description: Name of the dimension.
        type: string
      operator:
        description: the dimension operator. Only 'Include' and 'Exclude' are supported
        type: string
      values:
        description: list of dimension values.
        items:
          type: string
        type: array
    required:
      - name
      - operator
      - values
  MultiMetricCriteria:
    additionalProperties:
      type: object
    description: The types of conditions for a multi resource alert.
    discriminator: criterionType
    properties:
      criterionType:
        description: Specifies the type of threshold criteria
        enum:
          - StaticThresholdCriterion
          - DynamicThresholdCriterion
        x-ms-enum:
          modelAsString: true
          name: criterionType
      dimensions:
        description: List of dimension conditions.
        items:
          $ref: "#/definitions/MetricDimension"
        type: array
      metricName:
        description: Name of the metric.
        type: string
      metricNamespace:
        description: Namespace of the metric.
        type: string
      name:
        description: Name of the criteria.
        type: string
      timeAggregation:
        description: the criteria time aggregation types.
        enum:
          - Average
          - Minimum
          - Maximum
          - Total
        x-ms-enum:
          modelAsString: true
          name: AggregationType
    required:
      - criterionType
      - name
      - metricName
      - timeAggregation
    type: object
  Resource:
    description: An azure resource object
    properties:
      id:
        description: Azure resource Id
        readOnly: true
        type: string
      location:
        description: Resource location
        type: string
        x-ms-mutability:
          - create
          - read
      name:
        description: Azure resource name
        readOnly: true
        type: string
      tags:
        additionalProperties:
          type: string
        description: Resource tags
      type:
        description: Azure resource type
        readOnly: true
        type: string
    required:
      - location
    x-ms-azure-resource: true
