Big News! Split is now part of Harness. Learn more at Harness and read why we are excited by this move.

8 Things You Might Not Know About Azure Functions

Contents

Split - blog-Gray01-AzureFunction

Azure Functions is an available-on-demand cloud service that provides all the continually updated infrastructure and resources needed to run your applications. If you’re a .NET developer you’ve almost certainly used it before in your applications, but here are a few things you probably didn’t know it could do that are sure to save you some time or make your life easier.

1. With Azure Functions You Can Write in Multiple Languages

There are three versions of the Azure Functions Runtime and you can use various languages in each version. Notably, in version 3.x you can use:

  • C# in .NET 5.0 and below
  • F# in .NET Core 3.1 and below
  • Java 8 and 11
  • Python 3.6 through 3.9-Preview
  • JavaScript Node 14, 12, and 10
  • TypeScript
  • PowerShell 7.0 and Core 6

2. You Can Use the Azure Functions Host on Multiple Platforms

The Azure Functions host is written in .NET Core which means it can operate on any operating system that has .NET Core installed.

How awesome is that? That means your team can work on the same project regardless of their personal operating system.

3. With Azure Functions You Can Run and Debug Locally

You can run and debug Azure Functions locally using the Azure Functions Runtime. You can also test a function without having to install any packages. The best part? It runs on Windows, Mac, and most versions of Linux.

The advantage here is that you can debug through the local Azure Host to see exactly what’s going on in your application. Since it’s the exact same Azure Host used by Azure online you can get a pretty good look under the hood and see what your application is really doing. Now you don’t have to rely on error logs and logging to try and figure out what happened if your application crashes.

4. You Can Integrate Into Visual Studio Code With Azure Functions

The Azure Functions crew teamed up with Visual Studio to build an awesome extension. It allows you to create, deploy, and even stream logs locally in Visual Studio Code.

That means you don’t have to leave the editor to manage your functions and can continue to work on your code without breaking your flow.

5. You Can Trigger Azure Functions in a Ton of Different Ways

Things that trigger a function include; insertion into Blob Storage, Cosmos DB, Event Grid, Event Hub, Microsoft Graph, Storage Queue and Service Bus, and a call from an HTTP endpoint.

For instance, you could have an Azure Function execute every time an HTTP request is made to your API. The function could track and roll up information like client IP address, latency, user agent, etc. This is super useful in having an out-of-band way to track events that you don’t want to necessarily embed in your core code. It could also be very useful for asynchronous events. You might have an endpoint that kicks off a function and returns immediately to your client after kicking off an Azure Function. Your client could then poll an endpoint to see if the Azure Function was done and when it was, could report back a result.

6. You Can Chain Azure Functions

You can chain multiple Azure Functions together! It’s possible to call a function from a function, and in certain use cases that might be desirable.

For anything more complex, it’s much better to use Azure Durable Functions as it was made to help orchestrate function chaining. The big advantage here is that Durable Functions are stateful where standard Functions are stateless.

Using Durable Functions to orchestrate will allow you to process multiple functions with shared data and you’ll be able to call your functions in several different patterns.

Setting up an Azure Durable Function looks like this in either Visual Studio or VS Code:

Create a Durable Functions Orchestrator File

  1. Add a New Item in Visual Studio
  2. Azure Functions: Create Function in CS Code

Orchestrator File Code

Your Orchestration file will look like this:

const df = require("durable-functions");

module.exports = df.orchestrator(function* (context) {
  const outputs = [];

  // Replace "Hello" with the name of your Durable Activity Function.
  outputs.push(yield context.df.callActivity("Hello", "Tokyo"));
  outputs.push(yield context.df.callActivity("Hello", "Seattle"));
  outputs.push(yield context.df.callActivity("Hello", "London"));

  // returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
  return outputs;
});
JavaScript

This is a standard chain pattern that calls one function after the other. You can also use the Fan-out/Fan-in pattern which allows you to run multiple functions in parallel.

Deploy to Azure

When you deploy to Azure you’ll be prompted to attach the function to a storage account because you added the Orchestration file. If you don’t have one you’ll be prompted to create one

7. You Can Bind Azure Functions

Binding allows you to communicate with other services like Service Bus, Cosmos DB, Webhooks, SignalR, and more! Bindings can be connected as input bindings, output bindings, or both. Data from bindings is provided to the function as parameters.

Imagine being able to pull in data from almost anywhere with very little setup and overhead, and use that in your functions. Someone triggers a webhook or some other event in a completely different service and suddenly your functions are made aware of that and can not only react to the event but receive or pass data somewhere else at the same time.

An example would be; someone fills out a form in a third-party application* triggering an event that your function was listening for. Your function can immediately receive data from the event and process it without involving anyone (*The third party application would have to trigger an event in the Supported bindings and you’d have to have access from that third party.).

You can integrate Azure Functions with Split for CI/CD

You can create Azure functions that call the Split API allowing you to control your splits through in a variety of situations.

Using the supported Azure Triggers and Bindings talked about above you could automate control of your splits in a variety of situations giving you more control and flexibility. You could turn your splits on and off in response to a webhook being called.

You could rapidly add users to segments when they’re added to a database without having to alter any code in that workflow. Azure Functions would watch these supported applications and respond to their events with the given data to act on your splits the way you want to.

Learn More About Modern Software Delivery and Experimentation

I hope you enjoyed the post. It was really fun to learn more about Azure Functions and how they can be used to improve your workflow and continuous delivery. What are your favorite tips and tricks about Azure Functions? Hit me up on Twitter @Programazing and let me know!

If you liked this blog post check out a few of my favorites below:

Make sure you catch all our new releases as they come out! Follow us on Twitter @splitsoftware, and subscribe to our YouTube channel.

Get Split Certified

Split Arcade includes product explainer videos, clickable product tutorials, manipulatable code examples, and interactive challenges.

Switch It On With Split

The Split Feature Data Platform™ gives you the confidence to move fast without breaking things. Set up feature flags and safely deploy to production, controlling who sees which features and when. Connect every flag to contextual data, so you can know if your features are making things better or worse and act without hesitation. Effortlessly conduct feature experiments like A/B tests without slowing down. Whether you’re looking to increase your releases, to decrease your MTTR, or to ignite your dev team without burning them out–Split is both a feature management platform and partnership to revolutionize the way the work gets done. Switch on a free account today, schedule a demo, or contact us for further questions.

Want to Dive Deeper?

We have a lot to explore that can help you understand feature flags. Learn more about benefits, use cases, and real world applications that you can try.

Create Impact With Everything You Build

We’re excited to accompany you on your journey as you build faster, release safer, and launch impactful products.