Featured image of post What the heck is an Azure Function

What the heck is an Azure Function

TLDR: A solution that lets you deploy a piece of code that’s executed when an event happens. That event can be an HTTP request, a timer that elapsed, a blob that was created or a bunch of other things. Also, in the Consumption plan, they timeout after max 10 minutes (5 by default), so choosing them for long tasks isn’t the best idea.

What’s so cool with it?

Well, many things, to name a few:

  1. You literally only need to write a function that does a bunch of stuff and you’re good to go.
  2. Using the various bindings, you can react to pretty much whatever happens.
  3. Obviously, the whole serverless-advantage package.
  4. Visual Studio offers great templates to get you started.
  5. No need to worry about scaling. Azure Functions scale automatically, and you only pay for what you use, even in the Consumption plan.

What’s the catch?

  1. They timeout early. You only get 10 minutes max (5 by default) in the Consumption plan. So beware of your async tasks, or consider using Durable Functions.
  2. Cold starts when they go idle can be frustrating. BUT! You can always accompany your function with a “wake me up” function, something like this:
1
2
3
4
5
[Function("Function1")]
public void Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer)
{
  // I could log something here but I really just want to keep the func awake :)
}

Verdict

I love them and use them a lot, but I can’t neglect what they are intended to be used as. Short tasks, black boxes, data-in → data-out, is what Azure Functions are built for.

Disclaimer 1: URLs last checked 2022-10-12. Drop me a line if you find a broken link, please.

Disclaimer 2: It’s never my intention to create a parallel wiki. I try to write my own experiences and the way I see things, not copy official documentation or Stack Overflow.

All rights reserved
Built with Hugo
Theme Stack designed by Jimmy