共用方式為


Set-AzScheduledQueryRule

更新記錄警示規則

語法

Set-AzScheduledQueryRule
   -Source <PSScheduledQueryRuleSource>
   [-Schedule <PSScheduledQueryRuleSchedule>]
   -Action <PSScheduledQueryRuleAlertingAction>
   -Location <String>
   [-Description <String>]
   -Name <String>
   -ResourceGroupName <String>
   [-Tag <Hashtable>]
   [-Enabled <Boolean>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzScheduledQueryRule
   -InputObject <PSScheduledQueryRuleResource>
   [-Source <PSScheduledQueryRuleSource>]
   [-Schedule <PSScheduledQueryRuleSchedule>]
   [-Action <PSScheduledQueryRuleAlertingAction>]
   [-Location <String>]
   [-Description <String>]
   [-Tag <Hashtable>]
   [-Enabled <Boolean>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzScheduledQueryRule
   -ResourceId <String>
   -Source <PSScheduledQueryRuleSource>
   [-Schedule <PSScheduledQueryRuleSchedule>]
   -Action <PSScheduledQueryRuleAlertingAction>
   -Location <String>
   [-Description <String>]
   [-Tag <Hashtable>]
   [-Enabled <Boolean>]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

依 PUT 語意更新記錄警示規則

範例

範例 1 - 依規則名稱設定

PS C:\> Set-AzScheduledQueryRule -ResourceGroupName "MyResourceGroup" -Name "LogAlertRule1" -Enabled $true -Location "centralindia" -Action $alertingAction -Description "log alert description" -Schedule $schedule -Source $source

Description       : log alert description
Enabled           : true
LastUpdatedTime   : 19-Apr-19 12:45:04 PM
ProvisioningState : Succeeded
Source            : Microsoft.Azure.Management.Monitor.Models.Source
Schedule          : Microsoft.Azure.Management.Monitor.Models.Schedule
Action            : Microsoft.Azure.Management.Monitor.Models.AlertingAction
Id                : /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1
Name              : LogAlertRule1
Type              : microsoft.insights/scheduledqueryrules
Location          : centralindia
Tags              : {[hidden-link:/subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/workspaces/MyWorkspace, Resource]}

範例 2 - 輸入物件設定

PS C:\> Set-AzScheduledQueryRule -InputObject $sqr -Description "changed description"

Description       : changed description
Enabled           : true
LastUpdatedTime   : 19-Apr-19 12:46:38 PM
ProvisioningState : Succeeded
Source            : Microsoft.Azure.Management.Monitor.Models.Source
Schedule          : Microsoft.Azure.Management.Monitor.Models.Schedule
Action            : Microsoft.Azure.Management.Monitor.Models.AlertingAction
Id                : /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1
Name              : LogAlertRule1
Type              : microsoft.insights/scheduledqueryrules
Location          : centralindia
Tags              : {[hidden-link:/subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/workspaces/MyWorkspace, Resource]}

範例 3 - 依資源識別碼設定

PS C:\> Set-AzScheduledQueryRule -ResourceId "/subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1" -Enabled $true -Location "centralindia" -Action $alertingAction -Description "change description again" -Schedule $schedule -Source $source

Description       : change description again
Enabled           : true
LastUpdatedTime   : 19-Apr-19 12:47:59 PM
ProvisioningState : Succeeded
Source            : Microsoft.Azure.Management.Monitor.Models.Source
Schedule          : Microsoft.Azure.Management.Monitor.Models.Schedule
Action            : Microsoft.Azure.Management.Monitor.Models.AlertingAction
Id                : /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1
Name              : LogAlertRule1
Type              : microsoft.insights/scheduledqueryrules
Location          : centralindia
Tags              : {[hidden-link:/subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/workspaces/MyWorkspace, Resource]}

參數

-Action

排程的查詢規則警示動作

類型:PSScheduledQueryRuleAlertingAction
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-AsJob

在背景執行 Cmdlet

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Confirm

執行 Cmdlet 之前先提示您確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

用於與 Azure 通訊的認證、帳戶、租使用者和訂用帳戶。

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Description

此警示的描述

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Enabled

azure 警示狀態 - 有效值 - $true,$false

類型:Boolean
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-InputObject

排程的查詢規則資源

類型:PSScheduledQueryRuleResource
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Location

此警示的位置

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Name

警示名稱

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-ResourceGroupName

資源組名

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-ResourceId

資源識別碼

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Schedule

排程的查詢規則排程

類型:PSScheduledQueryRuleSchedule
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Source

排程的查詢規則來源

類型:PSScheduledQueryRuleSource
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Tag

資源標籤

類型:Hashtable
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-WhatIf

顯示執行 Cmdlet 後會發生的情況。 未執行 Cmdlet。

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

PSScheduledQueryRuleResource

String

PSScheduledQueryRuleSource

PSScheduledQueryRuleSchedule

PSScheduledQueryRuleAlertingAction

輸出

PSScheduledQueryRuleResource