3. Azure Functions
■ Function as a Service (FAAS)
■ Azure Functions is the glue and enabler for
Serverless
■ Azure Functions provides Event Driven
programming model
– Invocation is from a service trigger
■ Azure Function cost model
– Number of Invocations + Amount of
data used per second
■ Supports most programming languages
Javascript, Java, C# …
4. Azure Functions Constructs
■ Triggers
– Invokes Azure Functions on changes in the services
– Act as Events for all the functions
■ Input
– Provides a declarative way to access data during
computation
■ Bindings
– Invoked by Azure Functions for persisting data or
updating downstream processes
Triggers Input Bindings
■ Deployment Slots
– Switch the environments
■ HTTP Proxies
– For routing the HTTP traffic
6. Demo
■ Use Case
– Upload an image
– Crop and store the image for downstream processes
– Extract properties of the image e.g. background, foreground, dominant color etc and
send email once all processing completed
■ Demo Application usesAzure functions for processing
– Function for image metadata extraction
– Function for image cropping
– Function to check status of processing and send email
■ Function stores the data in CosmoDB
■ Crop Image and Image MetaData Services uses Azure ComputerVisionAPI’s
■ Email sent via SendGrid
7.
8. ■ Source code for same can be downloaded from
– https://github.com/veresh/azure-functions-serverless
■ For issues in getting code from the repo, please leave comment in the Repo.
Companies wants to build applications
Managing Infrastructure is pain
Azure functions enables Serverless.
Events like file uploaded to Blobs can trigger the functions
Common use case to inform multiple systems when a file is uploaded to the Azure Storage
What is input ?
Examples of Triggers, You can assume triggers like database triggers but only difference is they can be invoked from functions outside the process
Trigger example is image cropping, once an image is uploaded then you want to crop the image and then store the image in blob storage and send out an email.
Heart of Serverless programming
e.g. when a a user is added you might want to send an email
At a particular time you might want to get all pdf in azure storage and then index them
Or you want to schedule downloading files and put them in Azure storage
Note that all services can expose trigger so incoming email cannot be used as trigger.
Inputs are not available for all services, for example in between processing one cannot go and check mail box