Book Image

Mastering Azure Serverless Computing

By : Lorenzo Barbieri, Massimo Bonanni
Book Image

Mastering Azure Serverless Computing

By: Lorenzo Barbieri, Massimo Bonanni

Overview of this book

Application development has evolved from traditional monolithic app development to using serverless options and microservices. This book is designed to guide you through using Microsoft's Azure Functions to process data, integrate systems, and build simple APIs and microservices. You will discover how to apply serverless computing to speed up deployment and reduce downtime. You'll also explore Azure Functions, including its core functionalities and essential tools, along with understanding how to debug and even customize Azure Functions. In addition to this, the book will take you through how you can effectively implement DevOps and automation in your working environment. Toward the concluding chapters, you'll cover some quick tips, troubleshooting techniques, and real-world serverless use cases that will help you make the most of serverless computing. By the end of this book, you will have gained the skills you need to develop and deliver cost-effective Azure serverless solutions.
Table of Contents (19 chapters)
Free Chapter
Section 1: Azure Functions 2.0 Fundamentals
Section 2: Azure Functions 2.0 Deployment and Automation
Section 3: Serverless Orchestration, API Management, and Event Processing
Section 4: Real-World Serverless Use Cases

Dependency injection in Azure Functions

How can you inject your service inside an Azure Function body? In other words, how you can leverage the power of dependency injection in your Azure Functions?

Fortunately, the Azure Functions SDK 1.0.28 (and later versions) has the same dependency injection support that you can use in ASP.NET Core.

To use this dependency injection in your Azure Function, you have to go through the following steps:

  1. Convert your Azure Function class from a static class to a normal class:
public class MortgageFunctions
public async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
[Table("executionsTable", Connection = "StorageAccount")] ICollector<ExecutionRow> outputTable,