Azure / Azure/azure-powershell

New-AzureRmAutomationSchedule starttime offset not ignored when timezone present

Open
#7,844 8 comments 0 reactions 1 assignee Claimed by @Bpoe View on GitHub
act-codegen-extensibility-squad Automation customer-reported Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

I'm trying to create a schedule using New-AzureRmAutomationSchedule, but the start time is not being set correctly. The help doc says this under the `-StartTime` parameter: "If the TimeZone parameter is specified, the offset will be ignored and the time zone specified is used." When I supply the timezone it is not ignoring the offset in the StartTime, but is offsetting the StartTime between my local time and the specified time zone

### Script/Steps for Reproduction

```powershell
# running from a server configured with local timezone of PST

# properly creates schedule that starts 11/15/2018 8:00 AM (PT)
New-AzureRmAutomationSchedule -Name "testPT" -DayInterval 1 -StartTime "2018-11-15T08:00:00" -TimeZone "America/Los_Angeles"

# incorrectly creates schedule that starts 11/15/2018 12:00 AM (PT), expected 11/15/2018 8:00 AM (PT)
New-AzureRmAutomationSchedule -Name "testPT" -DayInterval 1 -StartTime "2018-11-15T08:00:00Z" -TimeZone "America/Los_Angeles"

# incorrectly creates schedule that starts 11/15/2018 11:00 AM (ET), expected 11/15/2018 8:00 AM (ET)
New-AzureRmAutomationSchedule -Name "testET" -DayInterval 1 -StartTime "2018-11-15T08:00:00" -TimeZone "America/New_York"

# incorrectly creates schedule that starts 11/15/2018 3:00 AM (ET), expected 11/15/2018 8:00 AM (ET)
New-AzureRmAutomationSchedule -Name "testET" -DayInterval 1 -StartTime "2018-11-15T08:00:00Z" -TimeZone "America/New_York"
```

### Module Version

```powershell
Get-Module -ListAvailable
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.11.0 AzureRM
Script 5.1.1 AzureRM.Automation {Get-AzureRMAutomationHybridWorkerGroup, Get-AzureRmAutoma...
```

### Environment Data

```powershell
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.2273
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2273
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.