Azure Data Factory V2 – Handling Daylight Savings using Azure Functions – Page 1.

Hi Everyone.
Apologies for the lack of posts. I will try to post more often!!

Since my last blog where I was meant to follow up and go through Data Factory Custom Activities, Azure Data Factory Version 2 has been released into Preview.
As of today, I still don’t believe the ‘Triggers’ for scheduling a Pipeline allow us to set a timezone, so we have to schedule at UTC.
In this blog, I will go through one of the ways we can work around this whilst creating the triggers in Data Factory itself. (It can also be done through Automation)

The first step for this is to create an Azure Function to return whether DST is active of not for your timezone.

To begin, sign into the Azure Portal using an account with permissions to create new resources / services.

Click on the + Create a resource to create a new resource..


Type Function App into the search field and press Enter.

Select Function App , publisher Microsoft.

Click Create

Fill in details for the new services

  • Type in a unique App name.
  • Select the Subscription.
  • Select either Create new or Use existing resource group.
  • Select OS.
  • Select a Hosting Plan.
  • Select a Location.
  • Select Storage.
  • Select if you want application insights.

Click Create, and in a few minutes the Function App will be created.

Once this is done, your Function App will be up and running.

With your Function App open, however over Functions and select the + Create New option. This window should pop up.

For this example, I’m going to create a Custom function.
Select Custom Function
Select HTTP trigger with C# as the language.

Fill out the HTTP trigger options. I’m using anonymous here as I’ll be deleting the Function App, but choose this in line with your organisations requirements.

Click Create to finish creating the Function.

Here is a copy of my code (I’m not a real coder, so don’t hate my code!)
Don’t forget to update the time zone with the specifics for where you are.

#r "Newtonsoft.Json"
using System.Net;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

public static HttpResponseMessage Run(HttpRequestMessage req, TraceWriter log)
    DateTime theTime = DateTime.Now;
    TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time");
    Response response = new Response() { isDST = tzi.IsDaylightSavingTime(theTime) };

    return new HttpResponseMessage(HttpStatusCode.OK)

         Content = new StringContent(JsonConvert.SerializeObject(response, Formatting.Indented)
                     , Encoding.UTF8, "application/json")



private class Response
            public bool isDST { get; set; }

A quick save, and a test run gives the following result :



Make note of the function URL





Head to my next blog for a sample ARM template to setup a Data Factory V2 Pipeline and use this.


Leave a Reply

Your email address will not be published. Required fields are marked *