Skip to content

[PS] Migrate ScheduledQueryRule in Monitor module to autorest v4 #28195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
17 changes: 17 additions & 0 deletions src/Monitor/Monitor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScheduledQueryRule.Autorest
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ScheduledQueryRule", "..\..\generated\Monitor\ScheduledQueryRule.Autorest\Az.ScheduledQueryRule.csproj", "{A3CBC4A9-A39C-4343-99F2-F3F53F20049B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScheduledQueryRule.Autorest", "ScheduledQueryRule.Autorest", "{DFE9A16E-4879-AFA3-BD8B-DBC73F42D0CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ScheduledQueryRule", "..\..\generated\Monitor\ScheduledQueryRule.Autorest\Az.ScheduledQueryRule.csproj", "{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}"
EndProject
Copy link
Preview

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate project entries are being added to the solution file. This creates redundant references that could cause build issues.

Suggested change
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScheduledQueryRule.Autorest", "ScheduledQueryRule.Autorest", "{DFE9A16E-4879-AFA3-BD8B-DBC73F42D0CA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.ScheduledQueryRule", "..\..\generated\Monitor\ScheduledQueryRule.Autorest\Az.ScheduledQueryRule.csproj", "{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}"
EndProject

Copilot uses AI. Check for mistakes.

Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -309,6 +313,18 @@ Global
{0A51A656-9092-4C82-83B5-524516C8FED7}.Release|x64.Build.0 = Release|Any CPU
{0A51A656-9092-4C82-83B5-524516C8FED7}.Release|x86.ActiveCfg = Release|Any CPU
{0A51A656-9092-4C82-83B5-524516C8FED7}.Release|x86.Build.0 = Release|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Debug|x64.ActiveCfg = Debug|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Debug|x64.Build.0 = Debug|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Debug|x86.ActiveCfg = Debug|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Debug|x86.Build.0 = Debug|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Release|Any CPU.Build.0 = Release|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Release|x64.ActiveCfg = Release|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Release|x64.Build.0 = Release|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Release|x86.ActiveCfg = Release|Any CPU
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77}.Release|x86.Build.0 = Release|Any CPU
{81F263BA-D395-42CB-A7E0-AFC20029C4BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81F263BA-D395-42CB-A7E0-AFC20029C4BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81F263BA-D395-42CB-A7E0-AFC20029C4BC}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -421,5 +437,6 @@ Global
{0D41ADE3-ABBA-445B-8990-EA015AD4203D} = {F5B68159-9278-7C75-41B6-315547561DBE}
{3BDF8EC5-1C35-4425-AB3C-6EF677F618E2} = {635E4282-7AFB-1B5B-749B-823438FF2057}
{ABBBEF38-2D27-4BBA-B980-BEEBDC2843F4} = {97973F8C-3EE1-368A-3B71-C62280C2DC8C}
{9E22CFC6-9848-4A63-ABED-225A7EE2BC77} = {DFE9A16E-4879-AFA3-BD8B-DBC73F42D0CA}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion src/Monitor/Monitor/help/Az.Monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Create an in-memory object for PlatformTelemetryDataSource.
Create an in-memory object for PrometheusForwarderDataSource.

### [New-AzScheduledQueryRule](New-AzScheduledQueryRule.md)
Creates or updates a scheduled query rule.
Create a scheduled query rule.

### [New-AzScheduledQueryRuleConditionObject](New-AzScheduledQueryRuleConditionObject.md)
Create an in-memory object for Condition.
Expand Down
3 changes: 1 addition & 2 deletions src/Monitor/Monitor/help/Get-AzScheduledQueryRule.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Accept wildcard characters: False

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.IScheduledQueryRuleIdentity
Expand Down Expand Up @@ -151,7 +150,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.Api20210801.IScheduledQueryRuleResource
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.IScheduledQueryRuleResource

## NOTES

Expand Down
96 changes: 70 additions & 26 deletions src/Monitor/Monitor/help/New-AzScheduledQueryRule.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,37 @@ schema: 2.0.0
# New-AzScheduledQueryRule

## SYNOPSIS
Creates or updates a scheduled query rule.
Create a scheduled query rule.

## SYNTAX

### CreateExpanded (Default)
```
New-AzScheduledQueryRule -Name <String> -ResourceGroupName <String> [-SubscriptionId <String>]
-Location <String> [-ActionCustomProperty <Hashtable>] [-ActionGroupResourceId <String[]>] [-AutoMitigate]
[-CheckWorkspaceAlertsStorageConfigured] [-CriterionAllOf <ICondition[]>] [-Description <String>]
[-DisplayName <String>] [-Enabled] [-EvaluationFrequency <TimeSpan>] [-Kind <Kind>]
[-DisplayName <String>] [-Enabled] [-EvaluationFrequency <TimeSpan>] [-Kind <String>]
[-MuteActionsDuration <TimeSpan>] [-OverrideQueryTimeRange <TimeSpan>] [-Scope <String[]>] [-Severity <Int64>]
[-SkipQueryValidation] [-Tag <Hashtable>] [-TargetResourceType <String[]>] [-WindowSize <TimeSpan>]
[-DefaultProfile <PSObject>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### CreateViaJsonFilePath
```
New-AzScheduledQueryRule -Name <String> -ResourceGroupName <String> [-SubscriptionId <String>]
-JsonFilePath <String> [-DefaultProfile <PSObject>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### CreateViaJsonString
```
New-AzScheduledQueryRule -Name <String> -ResourceGroupName <String> [-SubscriptionId <String>]
-JsonString <String> [-DefaultProfile <PSObject>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION
Creates or updates a scheduled query rule.
Create a scheduled query rule.

## EXAMPLES

Expand All @@ -44,7 +59,7 @@ The properties of an alert payload.

```yaml
Type: System.Collections.Hashtable
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -59,7 +74,7 @@ Action Group resource Ids to invoke when the alert fires.

```yaml
Type: System.String[]
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -76,7 +91,7 @@ Relevant only for rules of the kind LogAlert.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -93,7 +108,7 @@ Relevant only for rules of the kind LogAlert.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -105,11 +120,10 @@ Accept wildcard characters: False

### -CriterionAllOf
A list of conditions to evaluate against the specified scopes
To construct, see NOTES section for CRITERIONALLOF properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.Api20210801.ICondition[]
Parameter Sets: (All)
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.ICondition[]
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -140,7 +154,7 @@ The description of the scheduled query rule.

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -155,7 +169,7 @@ The display name of the alert rule

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -171,7 +185,7 @@ Value should be true or false

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -187,7 +201,7 @@ Relevant and required only for rules of the kind LogAlert.

```yaml
Type: System.TimeSpan
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -197,13 +211,43 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -JsonFilePath
Path of Json file supplied to the Create operation

```yaml
Type: System.String
Parameter Sets: CreateViaJsonFilePath
Aliases:

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

### -JsonString
Json string supplied to the Create operation

```yaml
Type: System.String
Parameter Sets: CreateViaJsonString
Aliases:

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

### -Kind
Indicates the type of scheduled query rule.
The default is LogAlert.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Support.Kind
Parameter Sets: (All)
Type: System.String
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -218,7 +262,7 @@ The geo-location where the resource lives

```yaml
Type: System.String
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: True
Expand All @@ -234,7 +278,7 @@ Relevant only for rules of the kind LogAlert.

```yaml
Type: System.TimeSpan
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -265,7 +309,7 @@ Relevant only for rules of the kind LogAlert.

```yaml
Type: System.TimeSpan
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -296,7 +340,7 @@ The list of resource id's that this scheduled query rule is scoped to.

```yaml
Type: System.String[]
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -314,7 +358,7 @@ Relevant and required only for rules of the kind LogAlert.

```yaml
Type: System.Int64
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -331,7 +375,7 @@ Relevant only for rules of the kind LogAlert.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -361,7 +405,7 @@ Resource tags.

```yaml
Type: System.Collections.Hashtable
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -378,7 +422,7 @@ Relevant only for rules of the kind LogAlert

```yaml
Type: System.String[]
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand All @@ -394,7 +438,7 @@ Relevant and required only for rules of the kind LogAlert.

```yaml
Type: System.TimeSpan
Parameter Sets: (All)
Parameter Sets: CreateExpanded
Aliases:

Required: False
Expand Down Expand Up @@ -442,7 +486,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.Api20210801.IScheduledQueryRuleResource
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.IScheduledQueryRuleResource

## NOTES

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: Az.ScheduledQueryRule.psm1-help.xml
Module Name: Az.Monitor
online version: https://learn.microsoft.com/powershell/module/Az.Monitor/new-AzScheduledQueryRuleConditionObject
online version: https://learn.microsoft.com/powershell/module/Az.Monitor/new-azscheduledqueryruleconditionobject
schema: 2.0.0
---

Expand All @@ -15,8 +15,8 @@ Create an in-memory object for Condition.
```
New-AzScheduledQueryRuleConditionObject [-Dimension <IDimension[]>]
[-FailingPeriodMinFailingPeriodsToAlert <Int64>] [-FailingPeriodNumberOfEvaluationPeriod <Int64>]
[-MetricMeasureColumn <String>] [-MetricName <String>] [-Operator <ConditionOperator>] [-Query <String>]
[-ResourceIdColumn <String>] [-Threshold <Double>] [-TimeAggregation <TimeAggregation>]
[-MetricMeasureColumn <String>] [-MetricName <String>] [-Operator <String>] [-Query <String>]
[-ResourceIdColumn <String>] [-Threshold <Double>] [-TimeAggregation <String>]
[<CommonParameters>]
```

Expand All @@ -37,10 +37,9 @@ Create condition object

### -Dimension
List of Dimensions conditions.
To construct, see NOTES section for DIMENSION properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.Api20210801.IDimension[]
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.IDimension[]
Parameter Sets: (All)
Aliases:

Expand Down Expand Up @@ -122,7 +121,7 @@ The criteria operator.
Relevant and required only for rules of the kind LogAlert.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Support.ConditionOperator
Type: System.String
Parameter Sets: (All)
Aliases:

Expand Down Expand Up @@ -186,7 +185,7 @@ Aggregation type.
Relevant and required only for rules of the kind LogAlert.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Support.TimeAggregation
Type: System.String
Parameter Sets: (All)
Aliases:

Expand All @@ -204,7 +203,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.Api20210801.Condition
### Microsoft.Azure.PowerShell.Cmdlets.Monitor.ScheduledQueryRule.Models.Condition

## NOTES

Expand Down
Loading