Azure / Azure/azure-powershell
Set-AzAlertProcessingRule Invalid DateTime Format Bug
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
The new Set-AzAlertProcessingRule cmdlet:
Below parameters only accept values in string representation of datetime format yyyy-MM-dd hh:mm:ss
-ScheduleStartDateTime
-ScheduleEndDateTime
Below parameters only accept values in string representation of time format hh:mm:ss
-ScheduleReccurenceStartTime
-ScheduleReccurenceEndTime
-ScheduleReccurence2StartTime
-ScheduleReccurence2EndTime
This does not allow for schedules later than 11:59:59 (AM).
[SetAzureAlertProcessingRule.cs](https://github.com/Azure/azure-powershell/blob/main/src/AlertsManagement/AlertsManagement/ActionRuleCommands/SetAzureAlertProcessingRule.cs)]
private void ValidateSchedule()
{
string format = "yyyy-MM-dd hh:mm:ss";
// needs to be string format = "yyyy-MM-dd HH:mm:ss";
}
### Issue script & Debug output
```PowerShell
DEBUG: 3:08:37 PM - SetAzureAlertProcessingRule begin processing with ParameterSet 'BySimplifiedFormatSuppressionActionRule'.
DEBUG: 3:08:37 PM - using account id 'email.address@contoso.com'...
VERBOSE: Performing the operation "" on target "scheduleName from resource group: resourceGroupName".
Set-AzAlertProcessingRule: Invalid ScheduleReccurenceStartTime Format
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.2.2
PSEdition Core
GitCommitId 7.2.2
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 0.4.0 Az.AlertsManagement {Get-AzAlert, Get-AzAlertObjectHistory, Get-AzAlertProcessingRule, Get-AzSmartGroup…}
```
### Error output
```PowerShell
Set-AzAlertProcessingRule: Invalid ScheduleReccurenceStartTime Format
```
Contributor guide
Research direction
Start in src/AlertsManagement/AlertsManagement/ActionRuleCommands/SetAzureAlertProcessingRule.cs, at the ValidateSchedule method, and reproduce the issue with the PowerShell command and a PM schedule. Check the listed date and recurrence time parameters against the required format; done means valid times after 11:59:59 AM no longer produce an invalid-format error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100