Azure Serverless Computing Cookbook
eBook - ePub

Azure Serverless Computing Cookbook

Build and monitor Azure applications hosted on serverless architecture using Azure functions, 3rd Edition

  1. 458 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Azure Serverless Computing Cookbook

Build and monitor Azure applications hosted on serverless architecture using Azure functions, 3rd Edition

About this book

Discover recipes for implementing solutions to real-world business problems through serverless applications

Key Features

  • Test, troubleshoot, and monitor Azure functions to deliver high-quality and reliable cloud-centric applications
  • Understand Visual Studio's integrated developer experience for Azure functions
  • Explore best practices for organizing and refactoring code within the Azure functions

Book Description

This third edition of Azure Serverless Computing Cookbook guides you through the development of a basic back-end web API that performs simple operations, helping you understand how to persist data in Azure Storage services. You'll cover the integration of Azure Functions with other cloud services, such as notifications (SendGrid and Twilio), Cognitive Services (computer vision), and Logic Apps, to build simple workflow-based applications.

With the help of this book, you'll be able to leverage Visual Studio tools to develop, build, test, and deploy Azure functions quickly. It also covers a variety of tools and methods for testing the functionality of Azure functions locally in the developer's workstation and in the cloud environment. Once you're familiar with the core features, you'll explore advanced concepts such as durable functions, starting with a "hello world" example, and learn about the scalable bulk upload use case, which uses durable function patterns, function chaining, and fan-out/fan-in.

By the end of this Azure book, you'll have gained the knowledge and practical experience needed to be able to create and deploy Azure applications on serverless architectures efficiently.

What you will learn

  • Implement continuous integration and continuous deployment (CI/CD) of Azure functions
  • Develop different event-based handlers in a serverless architecture
  • Integrate Azure functions with different Azure services to develop enterprise-level applications
  • Accelerate your cloud application development using Azure function triggers and bindings
  • Automate mundane tasks at various levels, from development to deployment and maintenance
  • Develop stateful serverless applications and self-healing jobs using durable functions

Who this book is for

If you are a cloud developer or architect who wants to build cloud-native systems and deploy serverless applications with Azure functions, this book is for you. Prior experience with Microsoft Azure core services will help you to make the most out of this book.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Azure Serverless Computing Cookbook by Praveen Kumar Sreeram in PDF and/or ePUB format, as well as other popular books in Informatik & Microsoft-Programmierung. We have over one million books available in our catalogue for you to explore.

Information

1. Accelerating cloud app development using Azure Functions

In this chapter, we'll cover the following recipes:
  • Building a back-end web API using HTTP triggers
  • Persisting employee details using Azure Table storage output bindings
  • Saving profile picture paths to queues using queue output bindings
  • Storing images in Azure Blob Storage
  • Resizing an image using an ImageResizer trigger

Introduction

Every software application requires back-end components that are responsible for taking care of the business logic and storing data in some kind of storage, such as databases and filesystems. Each of these back-end components can be developed using different technologies. Azure serverless technology allows us to develop these back-end APIs using Azure Functions.
Azure Functions provides many out-of-the-box templates that solve most common problems, such as connecting to storage and building web APIs. In this chapter, you'll learn how to use these built-in templates. Along with learning about concepts related to Azure serverless computing, we'll also implement a solution to the basic problem domain of creating the components required for an organization to manage internal employee information.
Figure 1.1 highlights the key processes that you will learn about in this chapter:
Key processes to be accomplished in the chapter
Figure 1.1: The key processes
Let's go through a step-by-step explanation of the figure to get a better understanding:
  1. Client call to the API.
  2. Persist employee details using Azure Table Storage.
  3. Save profile picture links to queues.
  4. Invoke a queue trigger as soon as a message is created.
  5. Create the blobs in Azure Blob Storage.
  6. Invoke the blob trigger as soon as a blob is created.
  7. Resize the image and store it in Azure Blob Storage.
We'll leverage Azure Functions' built-in templates using HTTP triggers, with the goal of resizing and storing images in Azure Blob Storage.

Building a back-end web API using HTTP triggers

In this recipe, we'll use Azure's serverless architecture to build a web API using HTTP triggers. These HTTP triggers could be consumed by any front-end application that is capable of making HTTP calls.

Getting ready

Let's start our journey of understanding Azure serverless computing using Azure Functions by creating a basic back-end web API that responds to HTTP requests:
  • Refer to https://azure.microsoft.com/free/ to see how to create a free Azure account.
  • Visit https://docs.microsoft.com/azure/azure-functions/functions-create-function-app-portal to learn about the step-by-step process of creating a function application, and https://docs.microsoft.com/azure/azure-functions/functions-create-first-azure-function to learn how to create a function. While creating a function, a storage account is also created to store all the files.
  • Learn more about Azure Functions at https://azure.microsoft.com/services/functions/.

    Note

    Remember the name of the storage account, as it will be used later in other chapters.
  • Once the function application is created, please familiarize yourself with the basic concepts of triggers and bindings, which are at the core of how Azure Functions works. I highly recommend referring to https://docs.microsoft.com/azure/azure-functions/functions-triggers-bindings before proceeding.

    Note

    We'll be using C# as the programming language throughout the book. Most of the functions are developed using the Azure Functions V3 runtime. However, as of the time of writing, a few recipes were not supported in the V3 runtime. Hopefully, soon after the publication of this book, Microsoft will have made those features available for the V3 runtime as well.

How to do it…

Perform the following steps to build a web API using HTTP triggers:
  1. Navigate to the Function App listing page by clicking on the Function Apps menu, which is available on the left-hand side.
  2. Create a new function by clicking on the + icon:
    Adding a new function
    Figure 1.2: Adding a new function
  3. You'll see the Azure Functions for .NET - getting started page, which prompts you to choose the type of tools based on your preference. For the initial few chapters, we'll use the In-portal option, which can quickly create Azure Functions right from the portal without making use of any tools. However, in the coming chapters, we'll make use of Visual Studio and Azure Functions Core Tools to create these functions:
    The Azure portal enables you to choose the development environment. Choose In-Portal to develop from within the Azure portal
    Figure 1.3: Choosing the development environment
  4. In the next step, select More templates… and click on Finish and view templates, as shown in Figure 1.4:
    Choosing More templates… and clicking Finish to view templates
    Figure 1.4: Choosing More templates… and clicking Finish and view templates
  5. In the Choose a template below or go to the quickstart section, choose HTTP trigger to create a new HTTP trigger function:
    Choosing the HTTP Trigger template to create a new function
    Figure 1.5: The HTTP trigger template
  6. Provide a meaningful name. For this example, I have used RegisterUser as the name of the Azure function.
  7. In the Authorization level drop-down menu, choose the Anonymous option. You'll learn more about all the authorization levels in Chapter 9, Configuring security for Azure Functions:
    Selecting the Anonymous option in the Authorization Level
    Figure 1....

Table of contents

  1. Preface
  2. 1. Accelerating cloud app development using Azure Functions
  3. 2. Working with notifications using the SendGrid and Twilio services
  4. 3. Seamless integration of Azure Functions with Azure Services
  5. 4. Developing Azure Functions using Visual Studio
  6. 5. Exploring testing tools for Azure functions
  7. 6. Troubleshooting and monitoring Azure Functions
  8. 7. Developing reliable serverless applications using durable functions
  9. 8. Bulk import of data using Azure Durable Functions and Cosmos DB
  10. 9. Configuring security for Azure Functions
  11. 10. Implementing best practices for Azure Functions
  12. 11. Configuring serverless applications in the production environment
  13. 12. Implementing and deploying continuous integration using Azure DevOps
  14. Index