Activity Log Alerts - Update
Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation.
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}?api-version=2020-10-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
activity
|
path | True |
string |
The name of the Activity Log Alert rule. |
resource
|
path | True |
string |
The name of the resource group. The name is case insensitive. |
subscription
|
path | True |
string |
The ID of the target subscription. |
api-version
|
query | True |
string |
The API version to use for this operation. |
Request Body
Name | Type | Description |
---|---|---|
properties.enabled |
boolean |
Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated. |
tags |
object |
The resource tags |
Responses
Name | Type | Description |
---|---|---|
200 OK |
An existing Activity Log Alert rule was successfully updated. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
Patch an Activity Log Alert rule
Sample request
PATCH https://management.azure.com/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/activityLogAlerts/SampleActivityLogAlertRule?api-version=2020-10-01
{
"tags": {
"key1": "value1",
"key2": "value2"
},
"properties": {
"enabled": false
}
}
Sample response
{
"id": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule",
"type": "Microsoft.Insights/ActivityLogAlerts",
"name": "SampleActivityLogAlertRule",
"location": "Global",
"tags": {
"key1": "value1",
"key2": "value2"
},
"properties": {
"scopes": [
"/subscriptions/187f412d-1758-44d9-b052-169e2564721d"
],
"condition": {
"allOf": [
{
"field": "category",
"equals": "Administrative"
},
{
"field": "level",
"equals": "Error"
}
]
},
"actions": {
"actionGroups": [
{
"actionGroupId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup",
"webhookProperties": {
"sampleWebhookProperty": "SamplePropertyValue"
}
}
]
},
"enabled": false,
"description": "Description of sample Activity Log Alert rule."
}
}
Definitions
Name | Description |
---|---|
Action |
A pointer to an Azure Action Group. |
Action |
A list of Activity Log Alert rule actions. |
Activity |
An Activity Log Alert rule resource. |
Alert |
An Activity Log Alert rule condition that is met when all its member conditions are met. |
Alert |
An Activity Log Alert rule condition that is met when all its member conditions are met. Each condition can be of one of the following types: Important: Each type has its unique subset of properties. Properties from different types CANNOT exist in one condition.
|
Alert |
An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. This condition must contain 'field' and either 'equals' or 'containsAny'. |
Alert |
An Activity Log Alert rule object for the body of patch operations. |
Error |
The error response. |
ActionGroup
A pointer to an Azure Action Group.
Name | Type | Description |
---|---|---|
actionGroupId |
string |
The resource ID of the Action Group. This cannot be null or empty. |
webhookProperties |
object |
the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. |
ActionList
A list of Activity Log Alert rule actions.
Name | Type | Description |
---|---|---|
actionGroups |
The list of the Action Groups. |
ActivityLogAlertResource
An Activity Log Alert rule resource.
Name | Type | Default value | Description |
---|---|---|---|
id |
string |
The resource Id. |
|
location |
string |
global |
The location of the resource. Azure Activity Log Alert rules are supported on Global, West Europe and North Europe regions. |
name |
string |
The name of the resource. |
|
properties.actions |
The actions that will activate when the condition is met. |
||
properties.condition |
The condition that will cause this alert to activate. |
||
properties.description |
string |
A description of this Activity Log Alert rule. |
|
properties.enabled |
boolean |
True |
Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated. |
properties.scopes |
string[] |
A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one item. |
|
tags |
object |
The tags of the resource. |
|
type |
string |
The type of the resource. |
AlertRuleAllOfCondition
An Activity Log Alert rule condition that is met when all its member conditions are met.
Name | Type | Description |
---|---|---|
allOf |
The list of Activity Log Alert rule conditions. |
AlertRuleAnyOfOrLeafCondition
An Activity Log Alert rule condition that is met when all its member conditions are met. Each condition can be of one of the following types: Important: Each type has its unique subset of properties. Properties from different types CANNOT exist in one condition.
- Leaf Condition - must contain 'field' and either 'equals' or 'containsAny'. Please note, 'anyOf' should not be set in a Leaf Condition.
- AnyOf Condition - must contain only 'anyOf' (which is an array of Leaf Conditions). Please note, 'field', 'equals' and 'containsAny' should not be set in an AnyOf Condition.
Name | Type | Description |
---|---|---|
anyOf |
An Activity Log Alert rule 'anyOf' condition. |
|
containsAny |
string[] |
The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met. |
equals |
string |
The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. |
field |
string |
The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. |
AlertRuleLeafCondition
An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. This condition must contain 'field' and either 'equals' or 'containsAny'.
Name | Type | Description |
---|---|---|
containsAny |
string[] |
The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met. |
equals |
string |
The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. |
field |
string |
The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. |
AlertRulePatchObject
An Activity Log Alert rule object for the body of patch operations.
Name | Type | Default value | Description |
---|---|---|---|
properties.enabled |
boolean |
True |
Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated. |
tags |
object |
The resource tags |
ErrorResponse
The error response.
Name | Type | Description |
---|---|---|
code |
string |
The error code. |
message |
string |
The error message indicating why the operation failed. |