New-AzScheduledQueryRuleSource

Creates an object of type Source

Syntax

New-AzScheduledQueryRuleSource
   -Query <String>
   [-AuthorizedResource <String[]>]
   -DataSourceId <String>
   [-QueryType <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

Creates an object of type Source. This object is to be passed to the command that creates Log Alert Rule

Examples

Example 1

PS C:\> $source = New-AzScheduledQueryRuleSource -Query "Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)"
                  -DataSourceId "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/MyResourceGroup/providers/Microsoft.OperationalInsights/workspaces/MyWorkspace"
				  -QueryType "ResultCount"

Parameters

-AuthorizedResource

The list of authorized resources for this alert

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DataSourceId

The data source on which this alert is created

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Query

The alert query

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-QueryType

Type of Query - currently supported values : ResultCount

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

Inputs

None

Outputs

PSScheduledQueryRuleSource