This new architecture doesn’t mean that an application would run without any servers. Instead, it would be divided into multiple reusable tasks executed through cloud development and implementation. These tasks then can be spread across multiple cloud servers managed by a third party and each offering a specific type of service.
This concept enables developers to focus on writing code for business logic right into the cloud, instead of focusing on the underlying infrastructure.
Microsoft offers the following options as part of the Azure Cloud Service under the serverless architecture category:
- Logic Apps
- Azure Functions
- Azure Service Fabric
- Azure Batch
As we already have covered Logic Apps in a previous blog post, this post will discuss Azure Functions, in detail, key features and different ways we can use them.
Azure Functions provides the ability to implement self-contained services in the form of small functions that enable the execution of code either on demand or on a scheduled basis. These functions run under ephermal containers that are created when the functions are called and are then destroyed when the function execution ends.
All the logic inside these functions runs or is executed through various events that are supported by Azure Functions, which makes every action event-driven. Developers can create these functions for the type of event they want as a trigger for running the desired code as indicated in the above image. 1
They just need to write the custom code that needs to be executed after an event occurs instead of worrying about the whole application or infrastructure that will be used to run these functions.
Azure Functions, a vital part of Microsoft Azure Cloud Services, can be created through Azure Web Portal, Azure CLI (Commands) or Visual Studio IDE.
Features of Azure Functions
- Language freedom – Azure functions can be written in multiple languages like C#, F#, Node.Js, Python, PHP, Power Shell and more. This gives developers the ability to select the language as per their choice and comfort.
- Third-party libraries – Azure Functions support the NuGet and NPM out of the box. So, developers can use any third-party dependencies.
- Integrated security enabling – Azure Functions can be triggered using HTTP and offer an integrated option to enable security protection using OAuth providers like AAD, Facebook, Google, Twitter, and others.
- Pay per use model – Charges will be calculated based on the time duration of code execution. There is no charge for the idle situation.
- Excellent integration – Azure Functions integrates with other Azure services like Event Hubs, Service Bus, Blob storage and other SaaS offerings.
- Release management support – This is offered from source control to deployment.
- High scalability – Azure Function can support complex and heavy workloads.
- Secure and capable management portal – It offers a single location for management.
Different types of triggers for Azure functions
There are different types of events supported by Azure Functions which can trigger them:
- Blob Trigger - In an event when blobs are added to a storage container, you may want to execute some custom logic. In this scenario, the Azure functions can be implemented with Blob Trigger. A standard use case may be when some image-related data gets added into Blob storage and the respective image processing is desired.
- Queue Trigger – In an event when any message is dropped in the Azure storage queue, and a custom business logic is executed, the Queue trigger template can be utilized. In this scenario, you may want to send emails after the execution of certain business logic. In such cases, just dropping a message into the storage queue can handle all the custom logic of sending the emails.
- HTTP Trigger - In case developers want to execute some piece of code on demand, HTTP triggers can be used. This execution is triggered using the HTTP request call.
- Timer Trigger – If any task needs to be executed on some scheduled time, then this trigger can be used. A use case for this can be some cleanup task that needs to be executed on a predefined schedule.
- Pipelined Triggers – The output from one function also can be used to trigger another function to create pipelines of processing.
- Some other supported triggers are –
- Event Hub Trigger
- Generic webhook
- GitHub webhook
- Service Bus Queue trigger
- Service Bus Topic trigger
Azure Functions is a great solution for rapid development of certain business logic that can run independently inside the cloud without having to manage the underlying infrastructure. One of the most important advantages is its automation and extensive scalability, which allows developers to implement complex and long-running tasks.
1 Reference: dannyvanderkraan.wordpress.com