O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Azure Serverless Computing Cookbook

Book Description

Over 50 recipes to help you build applications hosted on Serverless architecture using Azure Functions.

About This Book

  • Enhance Azure Functions with continuous deployment using Visual Studio Team Services
  • Learn to deploy and manage cost-effective and highly available serverless applications using Azure Functions
  • This recipe-based guide will teach you to build a robust serverless environment

Who This Book Is For

If you are a Cloud administrator, architect, or developer who wants to build scalable systems and deploy serverless applications with Azure functions, then this book is for you. Prior knowledge and hands-on experience with core services of Microsoft Azure is required.

What You Will Learn

  • Develop different event-based handlers supported by serverless architecture supported by Microsoft Cloud Platform – Azure
  • Integrate Azure Functions with different Azure Services to develop Enterprise-level applications
  • Get to know the best practices in organizing and refactoring the code within the Azure functions
  • Test, troubleshoot, and monitor the Azure functions to deliver high-quality, reliable, and robust cloud-centric applications
  • Automate mundane tasks at various levels right from development to deployment and maintenance
  • Learn how to develop statefulserverless applications and also self-healing jobs using DurableFunctions

In Detail

Microsoft provides a solution to easily run small segment of code in the Cloud with Azure Functions. Azure Functions provides solutions for processing data, integrating systems, and building simple APIs and microservices.

The book starts with intermediate-level recipes on serverless computing along with some use cases on benefits and key features of Azure Functions. Then, we’ll deep dive into the core aspects of Azure Functions such as the services it provides, how you can develop and write Azure functions, and how to monitor and troubleshoot them.

Moving on, you’ll get practical recipes on integrating DevOps with Azure functions, and providing continuous integration and continous deployment with Visual Studio Team Services. It also provides hands-on steps and tutorials based on real-world serverless use cases, to guide you through configuring and setting up your serverless environments with ease. Finally, you’ll see how to manage Azure functions, providing enterprise-level security and compliance to your serverless code architecture.

By the end of this book, you will have all the skills required to work with serverless code architecture, providing continuous delivery to your users.

Style and approach

This recipe-based guide explains the different features of Azure Function by taking a real-world application related to a specific domain. You will learn how to implement automation and DevOps and discover industry best practices to develop applications hosted on serverless architecture using Azure functions.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Conventions
    6. Reader feedback
    7. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Accelerate Your Cloud Application Development Using Azure Function Triggers and Bindings
    1. Introduction
    2. Building a backend Web API using HTTP triggers
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. See also
    3. Persisting employee details using Azure Storage table output bindings
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Understanding more about Storage Connection
        2. What is Azure Table storage service?
        3. Partition key and row key
      4. There's more...
    4. Saving the profile images to Queues using Queue output bindings
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    5. Storing the image in Azure Blob storage
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also...
    6. Cropping an image using ImageResizer trigger
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
  3. Working with Notifications Using SendGrid and Twilio Services
    1. Introduction
    2. Sending an email notification to the administrator of the website using the SendGrid service
      1. Getting ready
        1. Creating a SendGrid account
        2. Generating the SendGrid API key
        3. Configuring the SendGrid API key with the Azure Function app
      2. How to do it...
      3. How it works...
      4. See also
    3. Sending an email notification to the end user dynamically
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Implementing email logging in the Blob storage
      1. How to do it...
      2. How it works...
    5. Modifying the email content to include an attachment
      1. Getting ready
      2. How to do it...
        1. Customizing the log file name using IBinder interface
        2. Adding an attachment to the email
      3. There's more...
    6. Sending SMS notification to the end user using the Twilio service
      1. Getting ready
      2. How to do it...
      3. How it works...
  4. Seamless Integration of Azure Functions with Other Azure Services
    1. Introduction
    2. Using Cognitive Services to locate faces from the images
      1. Getting ready
        1. Creating a new Computer Vision API account
        2. Configuring App settings
      2. How to do it...
      3. How it works...
      4. There's more...
    3. Azure SQL Database interactions using Azure Functions
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Processing a file stored in OneDrive using an external file trigger
      1. Getting ready
      2. How to do it...
    5. Monitoring tweets using Logic Apps and notifying when popular users tweet
      1. Getting ready
      2. How to do it...
        1. Create a new Logic App
        2. Designing the Logic App with Twitter and Gmail connectors
        3. Testing the Logic App functionality
      3. How it works...
      4. See also
    6. Integrating Logic Apps with Azure Functions
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
  5. Understanding the Integrated Developer Experience of Visual Studio Tools for Azure Functions
    1. Introduction
    2. Creating the function app using Visual Studio 2017
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    3. Debugging C# Azure Functions on a local staged environment using Visual Studio 2017
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    4. Connecting to the Azure Cloud storage from local Visual Studio environment
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Deploying the Azure Function app to Azure Cloud using Visual Studio
      1. How to do it...
      2. There's more...
      3. See also
    6. Debugging live C# Azure Function hosted on the Microsoft Azure Cloud environment using Visual Studio
      1. Getting ready
      2. How to do it...
      3. See also
  6. Exploring Testing Tools for the Validation of Azure Functions
    1. Introduction
    2. Testing Azure Functions
      1. Getting ready
      2. How to do it...
        1. Testing HTTP triggers using Postman
        2. Testing Blob trigger using the Microsoft Storage Explorer
        3. Testing Queue trigger using the Azure Management portal
      3. There's more...
    3. Testing an Azure Function on a staged environment using deployment slots
      1. How to do it...
      2. There's more
    4. Load testing Azure Functions using VSTS
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    5. Creating and testing Azure Function locally using Azure CLI tools
      1. Getting ready
      2. How to do it...
    6. Testing and validating Azure Function responsiveness using Application Insights
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  7. Monitoring and Troubleshooting Azure Serverless Services
    1. Introduction
    2. Monitoring your Azure Functions
      1. Getting ready
      2. How to do it...
      3. There's more...
    3. Monitoring Azure Functions using Application Insights
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more ...
    4. Pushing custom telemetry details to analytics of Application Insights
      1. Getting ready
      2. How to do it...
        1. Creating AI function
        2. Configuring access keys
        3. Integrating and testing AI query
        4. Configuring the custom derived metric report
      3. How it works...
      4. See also
    5. Sending application telemetry details via email
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Integrating real-time AI monitoring data with Power BI using Azure Functions
      1. Getting ready
      2. How to do it...
        1. Configuring Power BI with dashboard, dataset, and push URI
        2. Creating Azure AI real-time Power BI - C# function
      3. How it works...
      4. There's more...
  8. Code Reusability and Refactoring the Code in Azure Functions
    1. Introduction
    2. Creating a common code repository for better manageability within a function app
      1. How to do it...
      2. How it works...
      3. There's more...
      4. See also
    3. Shared code across Azure Functions using class libraries
      1. How to do it...
      2. How it works...
      3. There's more...
      4. See also
    4. Azure Functions and precompiled assemblies
      1. Getting ready...
      2. How to do it...
        1. Creating a class library using Visual Studio
        2. Creating a new HTTP trigger Azure Function
      3. How it works...
      4. There's more...
      5. See also
    5. Migrating legacy C# application classes to Azure Functions using PowerShell
      1. Getting ready
      2. How to do it...
        1. Creating an application using Visual Studio
        2. Creating a new PowerShell Azure Function
      3. How it works...
      4. See also
    6. Using strongly typed classes in Azure Functions
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  9. Developing Reliable and Durable Serverless Applications Using Durable Functions
    1. Introduction
    2. Configuring Durable Functions in the Azure Management portal
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    3. Creating a hello world Durable Function app
      1. Getting ready
      2. How to do it...
        1. Creating HttpStart Function - the Orchestrator client
        2. Creating Orchestrator function
        3. Creating Activity function
      3. How it works...
      4. There's more...
      5. See also
    4. Testing and troubleshooting Durable Functions
      1. Getting ready
      2. How to do it...
      3. See also
    5. Implementing multithreaded reliable applications using Durable Functions
      1. Getting ready
      2. How to do it...
        1. Creating Orchestrator function
        2. Creating Activity function GetAllCustomers
        3. Creating Activity function CreateQRCodeImagesPerCustomer
      3. How it works...
      4. There's more...
      5. See also
  10. Implement Best Practices for Azure Functions
    1. Adding multiple messages to a Queue using the IAsyncCollector function
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    2. Implementing defensive applications using Azure Functions and Queue triggers
      1. Getting ready
      2. How to do it...
        1. CreateQueueMessage - C# Console Application
        2. Developing the Azure Function - Queue trigger
        3. Running tests using the Console Application
      3. How it works...
      4. There's more...
    3. Handling massive ingress using Event Hub for IoT and similar scenarios
      1. Getting ready
      2. How to do it...
        1. Creating an Azure Function Event Hub trigger 
        2. Developing a Console Application that simulates IoT data 
    4. Enabling authorization for function apps
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Controlling access to Azure Functions using function keys
      1. How to do it...
        1. Configuring the function key for each application
        2. Configuring one host key for all the functions in a single function app
      2. There's more...
      3. See also
  11. Implement Continuous Integration and Deployment of Azure Functions Using Visual Studio Team Services
    1. Introduction
      1. Prerequisites
    2. Continuous integration - creating a build definition
      1. How to do it...
      2. How it works...
      3. There's more...
      4. See also
    3. Continuous integration - queuing the build and trigger manually
      1. Getting ready
      2. How to do it...
      3. See also
    4. Configuring and triggering the automated build
      1. How to do it...
      2. How it works...
      3. There's more...
      4. See also 
    5. Creating a release definition
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Trigger the release automatically
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also