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.
Join the DZone community and get the full member experience.
Join For Freeazure functions is a serverless computing offer by microsoft. functions are scripts that can be written in javascript, c#, f#, python, php, bash, batch, or powershell. functions can be developed on visual studio using preview level tools or directly through the browser in the azure portal. this blog post introduces azure functions and shows how to build your first function.
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.
the new function is created and opened in the 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.
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.
Published at DZone with permission of Gunnar Peipman, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments