你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Set-AzScheduledQueryRule

更新日志警报规则

语法

ByRuleName (默认值)

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

ByInputObject

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

ByResourceId

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

说明

按 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/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1
Name              : LogAlertRule1
Type              : microsoft.insights/scheduledqueryrules
Location          : centralindia
Tags              : {[hidden-link:/subscriptions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/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/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1
Name              : LogAlertRule1
Type              : microsoft.insights/scheduledqueryrules
Location          : centralindia
Tags              : {[hidden-link:/subscriptions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/workspaces/MyWorkspace, Resource]}

示例 3 - 按资源 ID 设置

PS C:\> Set-AzScheduledQueryRule -ResourceId "/subscriptions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/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/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1
Name              : LogAlertRule1
Type              : microsoft.insights/scheduledqueryrules
Location          : centralindia
Tags              : {[hidden-link:/subscriptions/a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/workspaces/MyWorkspace, Resource]}

参数

-Action

计划查询规则 Alerting Action

参数属性

类型:PSScheduledQueryRuleAlertingAction
默认值:None
支持通配符:False
不显示:False

参数集

ByRuleName
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
ByResourceId
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-AsJob

在后台运行 cmdlet

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

在运行 cmdlet 之前,提示你进行确认。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

参数属性

类型:IAzureContextContainer
默认值:None
支持通配符:False
不显示:False
别名:AzContext, AzureRmContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Description

此警报的说明

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Enabled

azure 警报状态 - 有效值 - $true、$false

参数属性

类型:Boolean
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-InputObject

Scheduled Query Rule 资源

参数属性

类型:PSScheduledQueryRuleResource
默认值:None
支持通配符:False
不显示:False

参数集

ByInputObject
Position:Named
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Location

此警报的位置

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByRuleName
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
ByResourceId
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Name

警报名称

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByRuleName
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ResourceGroupName

资源组名称

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByRuleName
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ResourceId

资源 ID

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByResourceId
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Schedule

计划的查询规则计划

参数属性

类型:PSScheduledQueryRuleSchedule
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Source

计划查询规则源

参数属性

类型:PSScheduledQueryRuleSource
默认值:None
支持通配符:False
不显示:False

参数集

ByRuleName
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False
ByResourceId
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Tag

资源标记

参数属性

类型:Hashtable
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

显示 cmdlet 运行时会发生什么情况。 命令脚本未运行。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:无线

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

PSScheduledQueryRuleResource

String

PSScheduledQueryRuleSource

PSScheduledQueryRuleSchedule

PSScheduledQueryRuleAlertingAction

输出

PSScheduledQueryRuleResource