01 logo

What are Azure Functions and When to Use Them?

Learn about the serverless compute service offered by Microsoft Azure

By Harsh JainPublished 3 years ago 3 min read
2

What are Azure Functions?

Azure Function is a serverless compute service that enables user to run event-triggered code without having to provision or manage infrastructure. Being as a trigger-based service, it runs a script or piece of code in response to a variety of events. These are also considered as a FaaS (Function as a Service) cloud deployment model.

Let us see the features of Azure Functions:

  • Cost Effective: Azure Functions is free as long as you stand the monthly limits, but it’s very generous. So you can do a million executions with Azure Functions. You can run your code serverlessly without paying anything. You get 400,000 gigabytes seconds of compute, and only after that, you start paying like fractions and fractions of a cent. So Azure Functions is fantastic. If you have some jobs, some API, and you’re like, “I don’t want to have to take out, this is my own personal website, I don’t really want to be spending a lot of money”. Whatever it is for those types of calls, Azure Functions is super economical.
  • What languages can you use? Many languages and some new ones have been just recently announced. JavaScript: This is great because it means that you can pull in any npm packages. However, you’re used to developing your projects, the frameworks, the libraries you like, you can take advantage of those in your functions. Python: Currently Python 3.8 and lower versions are supported. So you can build some cool machine learning type scenarios, scripting scenarios. Other languages include .NET, C#, F# and, Java.
  • You can run functions locally: This is one of the awesome things about Azure Functions. So Azure provides what’s called the runtime. That’s the thing that runs your code, it triggers it. That’s completely open source and you can run it all locally, you can debug it all locally, so that if you want to quickly test something out, you don’t have to worry about installing anything complex like running docker, doing these switch gymnastics, you just say, “I’m ready to do my Azure Functions project, set breakpoints, debug, everything super familiar”. You can run it on Mac, Windows, everything.
  • VS Code Extension: This is one of my favorite things. Visual Studio Code team and Azure Functions teams had built a first-class extension. So you can create functions, you can deploy your functions, you can even stream logs from them in the Cloud. So everything you need to do all in Visual Studio Code, it feels supernatural. It’s just one of those amazing extensions in that gallery.
  • Bindings: These are the nice construct inside of the functions where if you need to communicate with other services like, “Hey, at the end of this function, I need to send a text message or I want to drop something into Cosmos DB”, bindings let you do that without writing code for it, without having to figure out that SDK. You just go into your metadata of your function locally or in the Cloud and say, "Hey, I want to bind a Twilio, I want to bind the Cosmos DB to queues, to topics, to storage, whatever else you might need to be dropping, and you pretty much just set a variable in your function and Azure will do the heavy lifting of actually sticking it with the service.

When to use Azure Functions?

Here are some of the use cases of Azure functions:

  • Scheduled Tasks.
  • Reminders and Notifications.
  • Lightweight Web API.
  • Sending background emails.
  • Running background backup tasks.
  • Doing back-end calculations.

Azure Durable Functions

As with Azure Functions, the compute is not dedicated to your function, you cannot maintain state. In other words, you cannot create stateful APIs, functions using Azure Functions. Here come the Azure Durable Functions which is an extension of Azure Functions that are used to write Stateful functions. It consists of the Orchestrator function, Activity functions and Entity functions that can be defined as a workflow.

product review
2

About the Creator

Reader insights

Be the first to share your insights about this piece.

How does it work?

Add your insights

Comments

There are no comments for this story

Be the first to respond and start the conversation.

Sign in to comment

    Find us on social media

    Miscellaneous links

    • Explore
    • Contact
    • Privacy Policy
    • Terms of Use
    • Support

    © 2024 Creatd, Inc. All Rights Reserved.