你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Update-AzScheduledQueryRule
更新日志警报规则
语法
Update-AzScheduledQueryRule
-Name <String>
-ResourceGroupName <String>
-Enabled <Boolean>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Update-AzScheduledQueryRule
-InputObject <PSScheduledQueryRuleResource>
-Enabled <Boolean>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Update-AzScheduledQueryRule
-ResourceId <String>
-Enabled <Boolean>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
更新日志警报规则,此命令仅支持更新“已启用”属性。 若要更新其他属性,请参阅“Set-AzScheduledQueryRule”命令。
示例
示例 1 - 按规则名称更新
PS C:\> Update-AzScheduledQueryRule -ResourceGroupName "MyResourceGroup" -Name "LogAlertRule1" -Enabled $false
Description : description
Enabled : false
LastUpdatedTime : 19-Apr-19 12:49:15 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:\> Update-AzScheduledQueryRule -InputObject $sqr -Enabled $false
Description : description
Enabled : false
LastUpdatedTime : 19-Apr-19 12:50:18 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 - 按资源 ID 更新
PS C:\> Update-AzScheduledQueryRule -ResourceId /subscriptions/ad825170-845c-47db-8f00-11978947b089/resourceGroups/MyResourceGroup/providers/microsoft.insights/scheduledqueryrules/LogAlertRule1 -Enabled $true
Description : description
Enabled : true
LastUpdatedTime : 19-Apr-19 12:51:14 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]}
参数
-Confirm
提示你在运行 cmdlet 之前进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Enabled
azure 警报状态 - 有效值 - $true,$false
类型: | Boolean |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-InputObject
计划查询规则资源
类型: | PSScheduledQueryRuleResource |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Name
警报名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-ResourceGroupName
资源组名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-ResourceId
资源 ID
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-WhatIf
显示运行该 cmdlet 时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |