Automation account schedules with time zones

Posted 12 April 2017 12:00 AM by Ivan Chesa, Junior SharePoint Developer @ ClearPeople

Recently I have been looking for information about how to deploy schedules within an automation account using Azure templates.

Microsoft added the possibility to choose the time zone along with the schedule time (which is great to avoid Daylight Saving Time changes), so I wanted to include this in my template deployments too. Because I found some troubles to find the information I needed (because I couldn’t find how to do it in different API reference pages) and I finally managed to do it, I think it would be good to share the solution with you all.

To set the time zone using the Azure Portal is as easy as selecting the time zone from a drop down list:

dropdown

With Azure PowerShell you also have the ability to do this using the “New-AzureRmAutomationSchedule” cmdlet along with the “-TimeZone” parameter.

But, let’s see how to do this with templates. This is the code I use to create a schedule with a template (I create the automation account within the same template and that’s why you see “concat” instead of references to the automation account resource in Azure):

{
"name": "[concat(parameters('accountName'), '/', parameters('scheduleName'))]",
"type": "Microsoft.Automation/automationAccounts/schedules",
"apiVersion": "2015-01-01-preview",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
],
"tags": {
"displayName": "Schedule"
},
"properties": {
"description": " ",
"startTime": "[parameters('scheduleStartTime')]",
"timeZone": "[parameters('scheduleTimeZoneId')]",
"isEnabled": true,
"interval": "day",
"frequency": "1"
}
}


The key here is the “timeZone” property. This property is the one I couldn’t find in the “official” documentation and the one which allows to set a time zone for your schedule object. This property accepts a string that can be the IANA ID or the Windows Time Zone ID for the time zone you want (POSH command works the same way). In my case I wanted to use the UK Time and I prefer to use IANA format, because in my opinion it is easier to visualize which zone are you setting. So, this is what I type as my “scheduleTimeZoneId” parameter:

"scheduleTimeZoneId": {
"value": "Europe/London"
}


Last but not least, as an additional tip, I wanted to explain how the “startTime” parameter works. It establishes the start time in UTC format, what it means that if you set the start time to 10:00 a.m. during the deployment today, what you will see in the schedule on Azure will be 11:00 a.m. because in London we are UTC+1 right now (April = summer time). For this reason, I recommend writing the string with the time using the DateTimeOffset format to avoid a little the confusion this can cause. Since I know I’m on UTC+1 at this moment, I set the “scheduleStartTime” value like this:

"scheduleStartTime": {
"value": "2017-05-04T10:00:00+01:00"
}


This way when I look at the schedule created on Azure I will see the same date and time I chose on my template.

I hope this helps and I see you in the next post! Do get in touch if you have any questions, we're happy to help!

Share:

Add your comment

 
 

 

Archive

Tagcloud

Digital Transformation employee engagement staff satisfaction productivity Microsoft Teams Office 365 Yammer cms content management system agile GDPR Microsoft Graph collaboration Microsoft sharepoint 2016 upgrade migration SharePoint Online 2016 Tech Trends Digital Disruption Context marketing marketing SharePoint 2010 SharePoint 2013 TFS Git security kentico Analytics intranet jquery QA Quality Assurance testing digital workspace content management websites Sitecore sitecore marketplace sitecore module cloud Microsoft Cloud Storage digital strategy technical consulting sitecore modules Experience database Sitecore 7 Sitecore 8 support account management customer experience Data Storage windows azure cms integration front end front end development prototype Cloud Storage StorSimple Front-end Development Layout SharePoint 2013 colour palette UI design website design log viewer sitecore cms website Azure big data business-critical sharepoint accessibility android apple chrome clear people clearpeople debug emulator ios mobile testing opera resize adobe desktop flash ie10 internet explorer 10 metro windows 8 bcsp SharePoint Advanced System Reporter reporting framework ControlMode form control master page placeholder publishing console SharePoint 2007 SharePoint error search search results search values software testing testing scenario audit content information architecture retention schedules PowerShell QuickLaunch scripts SharePoint server 2010 business solutions metalogix replication replicator storagepoint stena technet UK Technet picture library slideshow web part RTM released to manufacturing caml caml query MOSS 2007 query infopath