共用方式為


az monitor activity-log alert

管理活動記錄警示規則。

命令

名稱 Description 類型 狀態
az monitor activity-log alert action-group

管理活動記錄警示規則。

核心 GA
az monitor activity-log alert action-group add

將動作群組新增至此活動記錄警示規則。 它也可以用來覆寫特定動作群組的現有 Webhook 屬性。

核心 GA
az monitor activity-log alert action-group remove

從此活動記錄警示規則中移除動作群組。

核心 GA
az monitor activity-log alert create

建立預設活動記錄警示規則。

核心 GA
az monitor activity-log alert delete

刪除活動記錄警示。

核心 GA
az monitor activity-log alert list

列出資源群組或目前訂用帳戶下的活動記錄警示規則。

核心 GA
az monitor activity-log alert scope

管理活動記錄警示規則。

核心 GA
az monitor activity-log alert scope add

將範圍新增至此活動記錄警示規則。

核心 GA
az monitor activity-log alert scope remove

從此活動記錄警示規則中移除範圍。

核心 GA
az monitor activity-log alert show

取得活動記錄警示。

核心 GA
az monitor activity-log alert update

更新新的活動記錄警示或更新現有的活動記錄警示。

核心 GA

az monitor activity-log alert create

建立預設活動記錄警示規則。

此命令會建立默認活動記錄檔,其中一個條件會比較活動記錄 『category』 欄位等於 'ServiceHealth'。 新建立的活動記錄警示沒有附加任何動作群組。

az monitor activity-log alert create --activity-log-alert-name
                                     --resource-group
                                     [--action-group]
                                     [--all-of]
                                     [--condition]
                                     [--description]
                                     [--disable {0, 1, f, false, n, no, t, true, y, yes}]
                                     [--scope]
                                     [--tags]
                                     [--webhook-properties]

範例

建立具有預設設定的警示規則。

az monitor activity-log alert create -n AlertName -g ResourceGroup

建立警示規則,其中包含錯誤等級服務健康情況記錄的條件。

az monitor activity-log alert create -n AlertName -g ResourceGroup --condition category=ServiceHealth and level=Error

使用動作群組建立警示規則,並指定 Webhook 屬性。

az monitor activity-log alert create -n AlertName -g ResourceGroup -a /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/microsoft.insights/actionGroups/{ActionGroup} -w usage=test owner=jane

建立一開始停用的警示規則。

az monitor activity-log alert create -n AlertName -g ResourceGroup --disable

必要參數

--activity-log-alert-name --name -n

活動記錄警示的名稱。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

選擇性參數

--action-group -a

新增動作群組。 接受以空格分隔的動作群組標識碼。 標識元可以是動作群組的名稱或其資源識別碼。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

--all-of

活動記錄警示規則條件的清單。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

--condition -c

導致警示規則啟動的條件。 格式為 FIELD=VALUE[ 和 FIELD=VALUE...]字段的可能值為 'resourceId'、'category'、'caller'、'level'、'operationName'、'resourceGroup'、'resourceProvider'、'status'、'subStatus'、'resourceType'或以 'properties' 開頭的任何專案。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

--description

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

--disable

建立活動記錄警示規則之後,請停用它。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
預設值: False
--scope -s

將做為前置詞的字串清單。 警示規則只會套用至屬於下列其中一個前置詞的資源標識符的活動記錄。 如果未提供,則會使用subscriptionId。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

--tags

資源的標記。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

--webhook-properties -w

以 'key[=value]' 格式分隔的空間分隔 Webhook 屬性。 這些屬性會與此命令中新增的動作群組相關聯。 對於這些動作群組中的任何 Webhook 接收者,此數據會附加至 Webhook 承載。 若要將不同的 Webhook 屬性附加至不同的動作群組,請在個別的 update-action 命令中新增動作群組。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

az monitor activity-log alert delete

刪除活動記錄警示。

az monitor activity-log alert delete [--activity-log-alert-name]
                                     [--ids]
                                     [--resource-group]
                                     [--subscription]

選擇性參數

--activity-log-alert-name --name -n

活動記錄警示的名稱。

--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

az monitor activity-log alert list

列出資源群組或目前訂用帳戶下的活動記錄警示規則。

az monitor activity-log alert list [--resource-group]

選擇性參數

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

az monitor activity-log alert show

取得活動記錄警示。

az monitor activity-log alert show [--activity-log-alert-name]
                                   [--ids]
                                   [--resource-group]
                                   [--subscription]

選擇性參數

--activity-log-alert-name --name -n

活動記錄警示的名稱。

--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

az monitor activity-log alert update

更新新的活動記錄警示或更新現有的活動記錄警示。

az monitor activity-log alert update [--activity-log-alert-name]
                                     [--add]
                                     [--all-of]
                                     [--condition]
                                     [--description]
                                     [--enabled {0, 1, f, false, n, no, t, true, y, yes}]
                                     [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                                     [--ids]
                                     [--remove]
                                     [--resource-group]
                                     [--set]
                                     [--subscription]
                                     [--tags]

範例

更新條件

az monitor activity-log alert update -n AlertName -g ResourceGroup --condition category=ServiceHealth and level=Error

停用警示規則。

az monitor activity-log alert update -n AlertName -g ResourceGroup --enable false

更新此活動記錄警示規則的詳細數據。

az monitor activity-log alert update --enabled true --name MyActivityLogAlerts --resource- group MyResourceGroup --subscription MySubscription

更新此活動記錄警示的詳細數據。

az monitor activity-log alert update --name MyActivityLogAlerts --resource-group MyResourceGroup --tags key=value

選擇性參數

--activity-log-alert-name --name -n

活動記錄警示的名稱。

--add

藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例: --add property.listProperty <key=value, string or JSON string>.

--all-of

活動記錄警示規則條件的清單。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

--condition -c

導致警示規則啟動的條件。 格式為 FIELD=VALUE[ 和 FIELD=VALUE...]字段的可能值為 'resourceId'、'category'、'caller'、'level'、'operationName'、'resourceGroup'、'resourceProvider'、'status'、'subStatus'、'resourceType'或以 'properties' 開頭的任何專案。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

--description

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

--enabled

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

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--force-string

使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--remove

從清單中移除屬性或專案。 範例: --remove property.list <indexToRemove>--remove propertyToRemove

--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

--set

指定要設定的屬性路徑和值,以更新物件。 範例: --set property1.property2=<value>.

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--tags

資源的標記。 支援速記語法、json-file 和 yaml-file。 請嘗試 “??” 以顯示更多。

全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。