---
title: "PATCH /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"
method: PATCH
path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}"
---

# PATCH /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}

`PATCH /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}`

Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method.

## Path parameters

- `ruleName` string, required

## Parameters

- `../../../../../common-types/resource-management/v2/types.json#/components/parameters/SubscriptionIdParameter` — unresolved $ref
- `../../../../../common-types/resource-management/v2/types.json#/components/parameters/ResourceGroupNameParameter` — unresolved $ref
- `../../../../../common-types/resource-management/v2/types.json#/components/parameters/ApiVersionParameter` — unresolved $ref

## Request body

- AlertRuleResourcePatch — The alert rule object for patch operations.
  - `tags` unknown
  - `properties` AlertRule — An alert rule.
    - `name` string, required — the name of the alert rule.
    - `description` string — the description of the alert rule that will be included in the alert email.
    - `provisioningState` string — the provisioning state.
    - `isEnabled` boolean, required — the flag that indicates whether the alert rule is enabled.
    - `condition` RuleCondition, required — The condition that results in the alert rule being activated.
      - `odata.type` string, required — specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition (based on the number of failures of a web test), and ThresholdRuleCondition (based on the threshold of a metric).
      - `dataSource` RuleDataSource — The resource from which the rule collects its data.
        - `odata.type` string, required — specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource
        - `resourceUri` string — the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule.
        - `legacyResourceId` string — the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule.
        - `resourceLocation` string — the location of the resource.
        - `metricNamespace` string — the namespace of the metric.
    - `action` RuleAction — The action that is performed when the alert rule becomes active, and when an alert condition is resolved.
      - `odata.type` string, required — specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction.
    - `actions` RuleAction[] — the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
      - `odata.type` string, required — specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction.
    - `lastUpdatedTime` string, date-time — Last time the rule was updated in ISO8601 format.

## Response `200`

Successful request to update an alert rule

- AlertRuleResource — An azure resource object
  - `id` string — Azure resource Id
  - `name` string — Azure resource name
  - `type` string — Azure resource type
  - `location` string, required — Resource location
  - `tags` unknown

## Other responses

- `201` — Successful request to update an alert rule that resulted in a creation of the alert rule
- `default` — Error response describing why the operation failed.

## Changes

- **2021-12-16** (2016-03-01) `79e74929d99a` — 1 warning
  - deleted the `path` request parameter `resourceGroupName`
- **2021-01-18** (2016-03-01) `b643e77b4704` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/azure/apis/monitormanagementclient-3/changes/subscriptions/:subscriptionId/resourcegroups/:resourceGroupName/providers/Microsoft.Insights/alertrules/:ruleName/patch.md)

---

[API](https://skmtc.dev/azure/apis/monitormanagementclient-3.md) · [All operations](https://skmtc.dev/azure/apis/monitormanagementclient-3/llms.txt) · [OpenAPI document](https://skmtc.dev/azure/apis/monitormanagementclient-3/revisions/88a16b616a15?raw)
