共用方式為


Activity Log Alerts - Update

更新現有警示規則中的 [標記] 和 [已啟用] 欄位。 這個方法可用來更新警示規則標籤,以及啟用或停用警示規則。 若要更新其他欄位,請使用 CreateOrUpdate 作業。

PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}?api-version=2020-10-01

URI 參數

名稱 位於 必要 類型 Description
activityLogAlertName
path True

string

活動記錄警示規則的名稱。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

資源群組的名稱。 名稱不區分大小寫。

subscriptionId
path True

string

minLength: 1

目標訂用帳戶的標識碼。

api-version
query True

string

minLength: 1

要用於這項作業的 API 版本。

要求本文

名稱 類型 Description
properties.enabled

boolean

指出是否啟用此活動記錄警示規則。 如果未啟用活動記錄警示規則,則不會啟動其任何動作。

tags

object

資源標籤

回應

名稱 類型 Description
200 OK

ActivityLogAlertResource

已成功更新現有的活動記錄警示規則。

Other Status Codes

ErrorResponse

描述作業失敗原因的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

Patch an Activity Log Alert rule

範例要求

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
  }
}

範例回覆

{
  "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."
  }
}

定義

名稱 Description
ActionGroup

Azure 動作群組的指標。

ActionList

活動記錄警示規則動作的清單。

ActivityLogAlertResource

活動記錄警示規則資源。

AlertRuleAllOfCondition

符合其所有成員條件時所符合的活動記錄警示規則條件。

AlertRuleAnyOfOrLeafCondition

符合其所有成員條件時所符合的活動記錄警示規則條件。 每個條件可以是下列其中一種類型:重要:每個類型都有其唯一的屬性子集。 不同類型的屬性不能存在於一個條件中。

  • 分葉條件 - 必須包含 'field' 和 'equals' 或 'containsAny'。 請注意,'anyOf' 應該 不要在分葉條件中設定。
  • AnyOf 條件 - 必須只包含 'anyOf' (這是分葉條件陣列)。 請注意,'field'、'equals' 和 'containsAny' 應該 不要在 AnyOf 條件中設定。
AlertRuleLeafCondition

藉由比較活動記錄事件的欄位和值,符合活動記錄警示規則條件。 此條件必須包含 『field』 和 'equals' 或 'containsAny'。

AlertRulePatchObject

修補作業主體的活動記錄警示規則物件。

ErrorResponse

錯誤回應。

ActionGroup

Azure 動作群組的指標。

名稱 類型 Description
actionGroupId

string

動作群組的資源標識碼。 這不可以是 Null 或空白。

webhookProperties

object

要包含在後續作業中的自定義屬性字典。 這些數據會附加至 Webhook 承載。

ActionList

活動記錄警示規則動作的清單。

名稱 類型 Description
actionGroups

ActionGroup[]

動作群組的清單。

ActivityLogAlertResource

活動記錄警示規則資源。

名稱 類型 預設值 Description
id

string

資源標識碼。

location

string

global

資源的位置。 全域、西歐和北歐區域支援 Azure 活動記錄警示規則。

name

string

資源的名稱。

properties.actions

ActionList

符合條件時將會啟動的動作。

properties.condition

AlertRuleAllOfCondition

導致此警示啟動的條件。

properties.description

string

此活動記錄警示規則的描述。

properties.enabled

boolean

True

指出是否啟用此活動記錄警示規則。 如果未啟用活動記錄警示規則,則不會啟動其任何動作。

properties.scopes

string[]

將做為前置詞的資源標識符清單。 警示只會套用至資源標識碼低於下列其中一個前置詞的活動記錄事件。 此清單必須包含至少一個專案。

tags

object

資源的標記。

type

string

資源的型別。

AlertRuleAllOfCondition

符合其所有成員條件時所符合的活動記錄警示規則條件。

名稱 類型 Description
allOf

AlertRuleAnyOfOrLeafCondition[]

活動記錄警示規則條件的清單。

AlertRuleAnyOfOrLeafCondition

符合其所有成員條件時所符合的活動記錄警示規則條件。 每個條件可以是下列其中一種類型:重要:每個類型都有其唯一的屬性子集。 不同類型的屬性不能存在於一個條件中。

  • 分葉條件 - 必須包含 'field' 和 'equals' 或 'containsAny'。 請注意,'anyOf' 應該 不要在分葉條件中設定。
  • AnyOf 條件 - 必須只包含 'anyOf' (這是分葉條件陣列)。 請注意,'field'、'equals' 和 'containsAny' 應該 不要在 AnyOf 條件中設定。
名稱 類型 Description
anyOf

AlertRuleLeafCondition[]

活動記錄警示規則 『anyOf』 條件。
當至少符合其中一個成員分葉條件時,符合的活動記錄警示規則條件。

containsAny

string[]

事件欄位的值將會與此陣列中的值進行比較(不區分大小寫),以判斷是否符合條件。

equals

string

事件欄位的值將會與此值進行比較(不區分大小寫),以判斷是否符合條件。

field

string

此條件將檢查之活動記錄事件欄位的名稱。 此字段的可能值為(不區分大小寫):'resourceId'、'category'、'caller'、'level'、'operationName'、'resourceGroup'、'resourceProvider'、'status'、'subStatus'、'resourceType'或以 'properties' 開頭的任何專案。

AlertRuleLeafCondition

藉由比較活動記錄事件的欄位和值,符合活動記錄警示規則條件。 此條件必須包含 『field』 和 'equals' 或 'containsAny'。

名稱 類型 Description
containsAny

string[]

事件欄位的值將會與此陣列中的值進行比較(不區分大小寫),以判斷是否符合條件。

equals

string

事件欄位的值將會與此值進行比較(不區分大小寫),以判斷是否符合條件。

field

string

此條件將檢查之活動記錄事件欄位的名稱。 此字段的可能值為(不區分大小寫):'resourceId'、'category'、'caller'、'level'、'operationName'、'resourceGroup'、'resourceProvider'、'status'、'subStatus'、'resourceType'或以 'properties' 開頭的任何專案。

AlertRulePatchObject

修補作業主體的活動記錄警示規則物件。

名稱 類型 預設值 Description
properties.enabled

boolean

True

指出是否啟用此活動記錄警示規則。 如果未啟用活動記錄警示規則,則不會啟動其任何動作。

tags

object

資源標籤

ErrorResponse

錯誤回應。

名稱 類型 Description
code

string

錯誤碼。

message

string

錯誤訊息,指出作業失敗的原因。