Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Getting Started With Azure Functions

DZone's Guide to

Getting Started With Azure Functions

Azure Functions is a good way to trigger your functions in a serverless architecture. See what languages it supports as well as the tools you can use to create functions.

· Cloud Zone
Free Resource

Production-proven Mesosphere DC/OS is now even better with GPU scheduling, pods, troubleshooting, enhanced security, and over 100+ integrated services deployed in one-click.

Functions are run by triggered events. When run, functions may accept input parameters and can also return output to a supported service. For example, we may have a time-triggered function that accepts Azure Table as an input and Azure Notification Hub as an output service. The function processes the latest records in Azure Table Storage and generates notifications for users.

The following table lists triggers, inputs, and outputs that Azure Functions currently supports.

Triggers Inputs Outputs
Blob
Event hub
External file
External table
Generic web hook
GitHub commenter
GitHub web hook
Http request
Manual trigger
Queue trigger
Service Bus queue trigger
Service Bus topic trigger
Timer trigger
Azure Blob Storage
External File
External Table
Azure Table Storage
Azure DocumentDB Document
Azure Mobile Table Record
Bot Framework
Azure Event Hub
Azure Queue Storage
Azure Blob Storage
External File
External Table
HTTP
Azure Service Bus
Azure Table Storage
Azure DocumentDB document
Azure Mobile Table Record
Azure Notification Hub
SendGrid
Twilio SMS
Bot Framework

Building Your First Azure Function

Log into your Azure account and create a new function from the left menu. For this example, we'll choose TimerTrigger-CSharp as the function type. Give the function a name and leave the interval as it is.

Azure Functions: Creating new timer trigger function

The new function is created and opened in the function editor.

Azure Functions: Function editor

Although the editor runs in a browser, it has syntax highlighting. If the function is not developed online and tooling doesn’t support publishing to Azure, then users can upload function files to the server in the editor window. Also, keys needed to call functions are available here.

The default timer trigger function is primitive. It just writes out to console when it was executed. Let’s click Run and see the output, which is written to the log window below the function editor.

Azure Functions: Function log

Congrats! You just successfully ran your first Azure Function!

Visual Studio Tools for Azure Functions

Azure Functions can also be built on Visual Studio. There is a preview of Visual Studio Tools for Azure Functions available. There are some problems and limitations, as described in the .NET Web Development and Tools Blog, but still it is possible to develop functions in a familiar environment.

Visual Studio Tools comes with an Azure Functions emulator that we can use to run and debug functions on a local box. To find out more, I again refer you to the .NET Web Development and Tools Blog, as they have described the tools in-depth.

I will come back to tooling with my next posts that show what and how we can build on Azure Functions.

Wrapping Up

Azure Functions is serverless computing service by Microsoft. Functions are, usually by nature, simple scripts and can be built in the Azure portal or in Visual Studio. Visual Studio has preview-level tools for functions that we can use to build and debug functions on our development boxes. The Azure portal lets us monitor our functions and see if they have any health issues or problems. It was easy to build our first function using the browser and online function editor. We can consider Azure Functions as our choice for serverless, as it seems to work well.

Simply build, test, and deploy. Mesosphere DC/OS is the best way to run containers and big data anywhere offering production-proven flexibility and reliability.

Topics:
microsoft azure ,serverless architecture ,cloud ,azure functions ,tutorial

Published at DZone with permission of Gunnar Peipman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}