Book Image

Advanced Serverless Architectures with Microsoft Azure

By : Daniel Bass
Book Image

Advanced Serverless Architectures with Microsoft Azure

By: Daniel Bass

Overview of this book

Advanced Serverless Architectures with Microsoft Azure redefines your experience of designing serverless systems. It shows you how to tackle challenges of varying levels, not just the straightforward ones. You'll be learning how to deliver features quickly by building systems, which retain the scalability and benefits of serverless. You'll begin your journey by learning how to build a simple, completely serverless application. Then, you'll build a highly scalable solution using a queue, load messages onto the queue, and read them asynchronously. To boost your knowledge further, the book also features durable functions and ways to use them to solve errors in a complex system. You'll then learn about security by building a security solution from serverless components. Next, you’ll gain an understanding of observability and ways to leverage application insights to bring you performance benefits. As you approach the concluding chapters, you’ll explore chaos engineering and the benefits of resilience, by actively switching off a few of the functions within a complex system, submitting a request, and observing the resulting behavior. By the end of this book, you will have developed the skills you need to build and maintain increasingly complex systems that match evolving platform requirements.
Table of Contents (8 chapters)

Chapter 1: Complete Serverless Architectures

Activity 1: Creating a Serverless Application for Viewing User Data

  1. Open the Azure Portal and click on the New Collection option to create a new collection called users in the Cosmos DB database named serverless.

  2. Click on Documents inside the Collection, and then click on the New Document option to insert user data into the Cosmos DB. Create a user using the following JSON:

      "name": "Daniel",
      "emailAddress": "[email protected]"
  3. Using the function from Exercise 4, Displaying Product Data on your Serverless Website, as a template, read the user data from the Cosmos DB and return it. Make the following changes to the function body:

    public static async Task<List<User>> Run([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)]HttpRequest req, ILogger log)

    Figure 1.61: Function reading users from Cosmos DB

  4. Now, use the index.html file from Exercise 4, Displaying Product Data on your Serverless Website, as a template, and create an index.html file in a folder called website. Adjust it to read from the GetUsers function using the following code:


    Display the data in a table, using the following code for the function body:

    function rowOfDataFromObject(data){
      let row = document.createElement('tr');
      let nameTableElement = document.createElement('td');
      let emailTableElement = document.createElement('td');
      return row;

    Figure 1.62: index.html displaying users