5

I have a function on Azure with the follow function.json file:

{
    "bindings": [
        {
            "type": "timerTrigger",
            "direction": "in",
            "schedule": "0 0 3 * * *",
            "name": "myTimer"
        }
    ],
    "disabled": false
}

Unless I'm wrong, this should make the function run once a day, at 3AM ?

This is the signature of the function:

public static async Task Run(TimerInfo myTimer, TraceWriter log) {}

So what is it I'm doing wrong? The function works fine when I manually trigger it (clicking "Run" in the portal), but it didn't run at 3AM this morning, and it didn't yesterday either.

Edit: So, as suggested, I've changed the plan to a paid plan, and I've selected a dynamic plan. The logs still says nothing about the function getting activated at 3AM this morning.

enter image description here

Steen Tøttrup
  • 3,755
  • 2
  • 22
  • 36
  • I had the same problem in consumption (dynamic) plan, but that turned out to be timezone vs UTC confusion - make sure you rule that out. Not currently possible to configure timezone on trigger level: https://github.com/Azure/azure-webjobs-sdk-extensions/issues/178 – Jacek Gorgoń May 19 '17 at 09:39

1 Answers1

3

Apps that run in Classic mode require 'Always On' to be enabled. Double-check that this is enabled -- that would explain it.

There are two plans that Functions apps can run in: Dynamic and Classic. You choose the plan during app creation. There's currently no way to switch plans after the app has been created:

enter image description here

  • Classic Plans run on App Service plans just like other App Service apps. You can choose from Free, Basic, Standard, etc, and you control the scale yourself. If you are using a Classic Plan, you must turn on 'Always On' in order to have triggers fire reliably. This requires your site to be in Basic or Standard mode. You can manage this from your Function App (and check for 'Always On') by clicking 'Function app settings' -> 'Go to App Service Settings'. The 'Always On' setting lives in 'Application settings'.

  • Dynamic Plans are charged by execution. There's no concept of 'Always On' -- when a trigger fires, your site will be started (if it's not already) and your function will run.

See here for more details: https://azure.microsoft.com/en-us/documentation/articles/functions-scale/#choose-a-service-plan

brettsam
  • 2,702
  • 1
  • 15
  • 24
  • See also this related answer: http://stackoverflow.com/questions/39430932/how-do-i-turn-on-always-on-for-an-azure-function/39431332#39431332 – David Ebbo Oct 03 '16 at 17:39
  • That might very well be it, just no idea where to find this information? Looks like I have to switch change App Service Plan, maybe. – Steen Tøttrup Oct 04 '16 at 06:07
  • So, with a dynamic plan, it should work? It still doesn't, I've updated the question. – Steen Tøttrup Oct 05 '16 at 05:18
  • 1
    Strike that, it actually worked. I just needed to go to the monitor tab. The logs windows on the develop tab doesn't show what has happened besides what you do manually. It seems? – Steen Tøttrup Oct 05 '16 at 05:26