Book Image

Learning Azure Functions

Book Image

Learning Azure Functions

Overview of this book

Functions help you easily run small pieces of code in cloud with Azure functions without worrying about a whole application or the infrastructure to run it. With Azure functions, you can use triggers to execute your code and bindings to simplify the input and output of your code. This book will start with the basics of Azure Functions. You will learn the steps to set up the environment and the tools that we will be using in the further chapters. Once you have a better understanding of this, we will be creating our first hello world function app. Later you will be introduced to triggers, how they are used to activate a function, and how binding can be used to output results of a function.You will also explore the steps to create an assembly with complex functionality that can be used by functions. Next, this book will teach you to scale your functions and use them to process data, integrate systems, and build simple APIs and microservices. Finally, this book will cover some diagnostic techniques with Azure App services and best practices of working with Azure Functions. By the end of this book, you will be well-versed with the techniques of scaling your Azure functions and making the most of serverless architecture.
Table of Contents (17 chapters)
Title Page
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
Dedication
Preface

Using a Webhook with an Azure Function


We have already seen how to trigger an Azure Function with as Webhook. We can also trigger a Webhook with our Azure Function. We can bind the Webhook as an input to our Azure Function.

To bind a Webhook as an input to our Azure Function, create an HTTP trigger in the Azure Function:

  1. Click on + sign to add the Azure Function and select HttpTrigger - JavaScript, as shown in the following screenshot:
  1. Provide a name for the function and click on the Create button.
  2. Once the HttpTrigger is created, click on the Integrate button, as shown in the following screenshot:
  1. Now, check the options and change the Mode to Webhook. There will be only two options available: the first is Standard and the second is Webhook. By default, the Standard mode is selected.

 

  1. Once we change the Mode to Webhook, we will see another option, Webhook type.
  2. Three types of Webhook are available in the Azure Function:
    • *GitHub
    • *Generic JSON
    • *Slack
  1. Depending on our needs, we can select any of these...