Azure / Azure/azure-powershell

New-AzAutomationSchedule DaysOfMonth LastDay

Open
#21,163 7 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Automation bug customer-reported Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

Cmdlet:

New-AzAutomationSchedule

Issue Description:

When executing a command using the parameter **DaysOfMonth** and setting the value **LastDay**, the **Run on last day of month** setting in the resulting Automation Account Schedule remains set to **No**. No error is produced when executing, even though the setting for LastDay is never applied.

![ScheduleProperties](https://user-images.githubusercontent.com/38919668/224037718-d546333c-7b95-4203-9c63-4f298c30c4aa.png)

Command Executed:

$param = @{
Name = 'TestSchedule'
AutomationAccountName = 'test-aa'
ResourceGroupName = 'test-rg'
TimeZone = 'Etc/UTC'
StartTime = (Get-Date "13:00:00").AddDays(1)
MonthInterval = 1
DaysOfMonth = 'One', 'Fifteenth', 'LastDay'
}

New-AzAutomationSchedule @param

Expected Result:

It is expected that when LastDay is specified in the DaysOfMonth property, that the resulting schedule will have the **Run on last day of month** setting set to **Yes**.

### Issue script & Debug output

```PowerShell
StartTime : 2023-03-10 1:00:00 PM +00:00
ExpiryTime : 9999-12-31 11:59:00 PM +00:00
IsEnabled : True
NextRun : 2023-03-15 1:00:00 PM +00:00
Interval : 1
Frequency : Month
MonthlyScheduleOptions : Microsoft.Azure.Commands.Automation.Model.MonthlyScheduleOptions
WeeklyScheduleOptions :
TimeZone : Etc/UTC
ResourceGroupName : test-rg
AutomationAccountName : test-aa
Name : TestSchedule
CreationTime : 2023-03-09 1:50:21 PM +00:00
LastModifiedTime : 2023-03-09 1:50:21 PM +00:00
Description :
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 5.1.19041.2364
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.2364
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
ModuleType Version Name
---------- ------- ----
Script 2.12.0 Az.Accounts
Script 1.9.1 Az.Automation
```

### Error output

```PowerShell
No Output produced.
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the New-AzAutomationSchedule command with DaysOfMonth set to One, Fifteenth, and LastDay, then trace how that parameter is handled when creating an Automation Account schedule. Done means LastDay sets the resulting schedule's “Run on last day of month” setting to Yes without errors, with a regression test covering the command.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.