New-AzScheduledQueryRule

Creates a Log Alert Rule (Scheduled Query Rule type)

Syntax

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

Description

Creates a Log Alert Rule (Scheduled Query Rule type)

Examples

Example 1

PS C:\> New-AzScheduledQueryRule -Location "West Europe" -Action $alertingAction -Enabled $true -Description "log alert foo" -Schedule $schedule -Source $source -Name "LogAlertRule1"

Parameters

-Action

The scheduled query rule Alerting Action

Type:Microsoft.Azure.Commands.Insights.OutputClasses.PSScheduledQueryRuleAlertingAction
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

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
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Description

The description for this alert

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Enabled

The azure alert state - valid values - $true, $false

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Location

The location for this alert

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

The alert name

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

The resource group name

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Schedule

The scheduled query rule schedule

Type:Microsoft.Azure.Commands.Insights.OutputClasses.PSScheduledQueryRuleSchedule
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Source

The scheduled query rule source

Type:Microsoft.Azure.Commands.Insights.OutputClasses.PSScheduledQueryRuleSource
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Tag

Resource tags

Type:Hashtable
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

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

Inputs

String

Outputs

Microsoft.Azure.Commands.Insights.OutputClasses.PSScheduledQueryRuleResource