Update-AzScheduledQueryRule
Updates a Log Alert rule
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
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>]
Description
Updates a Log Alert rule, updating only "Enabled" property is supported by this command. To update other properties, see Set-AzScheduledQueryRule command.
Examples
Example 1: Update by rule name
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]}
Example 2: Update by input object
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]}
Example 3: Update by resource 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]}
Parameters
Prompts you for confirmation before running the cmdlet.
| Type: | SwitchParameter |
| Aliases: | cf |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The azure alert state - valid values - $true, $false
| Type: | Boolean |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The Scheduled Query Rule resource
| Type: | PSScheduledQueryRuleResource |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The alert name
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The resource group name
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The resource Id
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Type: | SwitchParameter |
| Aliases: | wi |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |