Webhook、自动化 runbook、逻辑应用作为 Azure 事件网格事件的事件处理程序Webhooks, Automation runbooks, Logic Apps as event handlers for Azure Event Grid events

事件处理程序是发送事件的位置。An event handler is the place where the event is sent. 处理程序将执行一些进一步的操作来处理事件。The handler takes some further action to process the event. 会自动将多个 Azure 服务配置为处理事件。Several Azure services are automatically configured to handle events. 也可以使用任意 Webhook 来处理事件。You can also use any WebHook for handling events. Webhook 不需要托管在 Azure 中便可处理事件。The WebHook doesn't need to be hosted in Azure to handle events. 事件网格仅支持 HTTPS Webhook 终结点。Event Grid only supports HTTPS Webhook endpoints.

备注

  • 支持通过 Webhook 将 Azure 自动化 runbook 和逻辑应用用作事件处理程序。Azure Automation runbooks and logic apps are supported as event handlers via webhooks.
  • 尽管可以使用“Webhook”作为终结点类型来将 Azure 函数配置为事件处理程序,但请使用“Azure 函数”作为终结点类型 。Even though you can use Webhook as an endpoint type to configure an Azure function as an event handler, use Azure Function as an endpoint type. 有关详细信息,请参阅 Azure 函数作为事件处理程序For more information, see Azure function as an event handler.

WebhookWebhooks

有关使用 Webhook 作为事件处理程序的概述和示例,请参阅以下文章。See the following articles for an overview and examples of using webhooks as event handlers.

标题Title 说明Description
快速入门:使用 Azure CLIPowerShell门户创建和路由自定义事件。Quickstart: create and route custom events with - Azure CLI, PowerShell, and portal. 展示了如何将自定义事件发送到 WebHook。Shows how to send custom events to a WebHook.
快速入门:使用 Azure CLIPowerShell门户将 Blob 存储事件路由到自定义 Web 终结点。Quickstart: route Blob storage events to a custom web endpoint with - Azure CLI, PowerShell, and portal. 展示了如何将 Blob 存储事件发送到 WebHook。Shows how to send blob storage events to a WebHook.
概述:将事件接收到 HTTP 终结点Overview: receive events to an HTTP endpoint 介绍如何验证 HTTP 终结点以接收来自事件订阅的事件,然后接收和反序列化事件。Describes how to validate an HTTP endpoint to receive events from an Event Subscription, and receive and deserialize events.

逻辑应用Logic Apps

使用逻辑应用实现处理事件网格事件所需的业务流程。Use Logic Apps to implement business processes to process Event Grid events. 在这种情况下,不显式创建 Webhook。You don't create a webhook explicitly in this scenario. 当你将逻辑应用配置为处理事件网格中的事件时,系统会自动为你创建 Webhook。The webhook is created for you automatically when you configure the logic app to handle events from Event Grid. 有关示例,请参阅以下教程:See the following tutorials for examples:

标题Title 描述Description
教程:使用逻辑应用发送有关 Azure IoT 中心事件的电子邮件通知Tutorial: Send email notifications about Azure IoT Hub events using Logic Apps 每次将设备添加到 IoT 中心时,逻辑应用就会发送一封通知电子邮件。A logic app sends a notification email every time a device is added to your IoT hub.
教程:使用 Azure Functions 和 Azure 逻辑应用响应通过 Azure 事件网格收到的 Azure 服务总线事件Tutorial: Respond to Azure Service Bus events received via Azure Event Grid by using Azure Functions and Azure Logic Apps 事件网格将消息从服务总线主题发送到函数应用和逻辑应用。Event Grid sends messages from Service Bus topic to function app and logic app.

REST 示例(适用于 PUT)REST example (for PUT)

{
    "properties": 
    {
        "destination": 
        {
            "endpointType": "WebHook",
            "properties": 
            {
                "endpointUrl": "<WEB HOOK URL>",
                "maxEventsPerBatch": 1,
                "preferredBatchSizeInKilobytes": 64
            }
        },
        "eventDeliverySchema": "EventGridSchema"
    }
}

后续步骤Next steps

如需支持的事件处理程序的列表,请参阅事件处理程序一文。See the Event handlers article for a list of supported event handlers.