Mastering Azure Serverless Computing
eBook - ePub

Mastering Azure Serverless Computing

A practical guide to building and deploying enterprise-grade serverless applications using Azure Functions

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

Mastering Azure Serverless Computing

A practical guide to building and deploying enterprise-grade serverless applications using Azure Functions

About this book

Become an expert in implementing Azure Functions to work seamlessly with your serverless applications

Key Features

  • Develop scalable, robust multi-tier apps without worrying about infrastructure needs
  • Deploy and manage cost-effective and highly available serverless apps using Azure Functions
  • Accelerate enterprise-level application development by seamlessly integrating different cloud services with Azure Functions

Book Description

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.

What you will learn

  • Create and deploy advanced Azure Functions
  • Learn to extend the runtime of Azure Functions
  • Orchestrate your logic through code or a visual workflow
  • Add caching, security, routing, and filtering to your APIs
  • Use serverless technologies in real-world scenarios
  • Understand how to apply DevOps and automation to your working environment

Who this book is for

This book is designed for cloud administrators, architects, and developers interested in building scalable systems and deploying serverless applications with Azure Functions. Prior knowledge of core Microsoft Azure services and Azure Functions is necessary to understand the topics covered in this book.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Year
2019
Print ISBN
9781789951226
eBook ISBN
9781789952056

Section 1: Azure Functions 2.0 Fundamentals

This section shows the reader how to create an Azure Function, how it works, how to customize it, and how to use languages other than C#.
It comprises the following chapters:
  • Chapter 1, Developing and Running Azure Functions
  • Chapter 2, Customizing Your Azure Functions
  • Chapter 3, Programming Languages Supported in Azure Functions

Developing and Running Azure Functions

Azure Functions is one of the serverless technologies offered by Azure. It allows you to run code on-demand in response to a variety of events.
In this chapter, we will provide a brief explanation of what Azure Functions is and how it works. We will also introduce all the tools you can use to create, develop, and test a solution based on Azure Functions. The first tool we will look at is Azure Functions Core Tools, which is the most important tool you can use when you start to develop your Azure Functions solution because with it you can create, test, and deploy your Azure Functions. In this chapter, you will also learn how Visual Studio and Visual Studio Code can help you to improve your developer experience and how you can use other tools to support the documentation and testing phases.
This chapter will cover the following topics:
  • Introduction to Azure Functions
  • Azure Functions Core Tools and the Azure Functions runtime
  • Creating Azure Functions in Visual Studio and Visual Studio Code
  • Using the OpenAPI specification to document the API
  • Using ngrok to expose a local Azure Function on the internet
  • Debugging an Azure Function both locally and remotely

Technical requirements

If you want to start to develop solutions with Azure Functions, you have to know one of the languages Azure Functions supports (at this moment in time, C#, JavaScript, Java, and Python). If you do, you'll easily be able to follow this book.
The Microsoft entry point for the Azure Functions documentation is located at https://azure.microsoft.com/en-us/services/functions/. Starting from there, you can find technical documentation, whitepapers, and samples, and you can navigate to the GitHub repositories for the different tools you'll encounter in this book.
Finally, you can find the source code for this book at https://github.com/PacktPublishing/Mastering-Azure-Serverless-Computing/tree/master/Chapter01.

Introduction to Azure Functions

The Azure Functions platform allows you to run a piece of code (basically a simple function) in response to a wide variety of events; for example, you can run code when a client makes an HTTP request or when someone puts a message into a queue.
There are two fundamental concepts to understand when approaching the world of Azure Functions—triggers and bindings:
  • Triggers are what cause a function to run; they define what kind of event the function responds to. A trigger tells you how a function is called, and a function must have exactly one trigger. Triggers have associated data, which is often provided as the payload of the function, and you can use the data contained in the payload to better understand the nature of the event that wakes up your function.
  • Bindings are the way functions can exchange data with other cloud services such as Storage, Queue, or Cosmos DB. Bindings are defined in a declarative way: this means that you declare what kind of binding you need (for example, you might want to manage data with a Cosmos DB instance or write data into Azure Table storage) and the Azure Functions runtime provides the actual instance to the function to manage the data.
An Azure Function can have multiple bindings, and every binding can manage data input or output (or both—binding data can be received by the function or sent by the function to the connected services). A trigger can have only the input data (a trigger only receives data from the connected services and cannot send data to the services).
In version 1.x of the Azure Functions runtime, triggers and bindings were included in the runtime itself, while in version 2.x, triggers and bindings must be added as extensions, using NuGet packages. This means that you can reference only triggers and bindings you actually need and don't need to have all the supported triggers and bindings available for Azure Functions. Furthermore, the extension approach used by version 2.x allows you to create your own triggers and bindings. The advantage of being able to implement your own triggers and bindings is to delegate to the runtime the creation and the life cycle of the instances used by the function. In essence, the runtime acts as a dependency resolver for the instances required for the function. In runtime version 2.x, the only triggers available without adding extensions as NuGet packages are HttpTrigger and TimeTrigger; they are included in the Azure Functions SDK.
At the time of writing this book, the languages supported by Azure Functions (in version 2.x) are C#, F#, JavaScript, Java, Python (in preview), and PowerShell. The following table shows all the languages supported by the related frameworks:
Language
Framework
C#
.NET Core 2.x
JavaScript
Node.js 8 and 10
F#
.NET Core 2.x/3.x
Java
Java 8
Python
Python 3.6
TypeScript
Supported through transpiling to JavaScript
PowerShell
PowerShell Core 6 (preview)
The Azure Functions runtime is also designed to support language extensibility; that is, it's possible to create your own language worker process to manage your own programming language. The JavaScript and Java languages are built with this extensibility.
As for version 1.x of Azure Functions, a function app is a container of your functions. In version 2.x of the Azure Functions runtime, unlike what happened in version 1.x, a function app can host functions written in a single programming language.
An Azure Function written in C# is a static method decored by the FunctionName attribute:
public static class SimpleExample
{
[FunctionName("QueueTrigger")]
public static void Run(
[QueueTrigger("inputQueue")] string inItem,
[Queue("outputQueue")] out string outItem,
ILogger log)
{
log.LogInformation($"C# function processed: {inItem}");
}
}
FunctionName allows you to set th...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. About Packt
  5. Contributors
  6. Preface
  7. Section 1: Azure Functions 2.0 Fundamentals
  8. Developing and Running Azure Functions
  9. Customizing Your Azure Functions
  10. Programming Languages Supported in Azure Functions
  11. Section 2: Azure Functions 2.0 Deployment and Automation
  12. Deploying and Configuring Your Azure Functions
  13. Leverage the Power of DevOps with Azure Functions
  14. Testing and Monitoring
  15. Serverless and Containers
  16. Section 3: Serverless Orchestration, API Management, and Event Processing
  17. Orchestration as Code - Durable Functions
  18. Orchestration as Design - Logic Apps
  19. Empowering Your Serverless API with API Management
  20. High-Scale Serverless Event Processing with Event Grid
  21. Section 4: Real-World Serverless Use Cases
  22. Best Practices and Use Cases for Azure Serverless Computing
  23. Assessments
  24. Another Book You May Enjoy

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
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
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 990+ topics, we’ve got you covered! Learn about our mission
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 about Read Aloud
Yes! You can use the Perlego app on both iOS and 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 Mastering Azure Serverless Computing by Lorenzo Barbieri, Massimo Bonanni in PDF and/or ePUB format, as well as other popular books in Business & Business Intelligence. We have over one million books available in our catalogue for you to explore.