แก้ไข

แชร์ผ่าน


Webhooks, Automation runbooks, and Logic Apps as event handlers for Azure Event Grid events

An event handler receives events from an event source through Event Grid and processes those events. You can use any webhook as an event handler for events that Event Grid forwards. The webhook doesn't need to be hosted in Azure to handle events. Event Grid supports only HTTPS webhook endpoints. You can also use an Azure Automation runbook or an Azure Logic App as an event handler through webhooks. This article provides links to conceptual, quickstart, and tutorial articles that give you more information.

Note

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. For more information, see Azure function as an event handler.

Webhooks

For an overview and examples of using webhooks as event handlers, see the following articles.

Title Description
Quickstart: create and route custom events with - Azure CLI, PowerShell, and portal. Shows how to send custom events to a webhook.
Quickstart: route Blob storage events to a custom web endpoint with - Azure CLI, PowerShell, and portal. Shows how to send blob storage events to a webhook.
Quickstart: send container registry events Shows how to use Azure CLI to send Container Registry events.
Overview: receive events to an HTTP endpoint Describes how to validate an HTTP endpoint to receive events from an event subscription, and receive and deserialize events.

Azure Automation

You can process events by using Azure Automation runbooks. Event Grid supports processing of events by using automated runbooks through webhooks. You create a webhook for the runbook and then use the webhook handler. For an example, see the following tutorial:

Title Description
Tutorial: Azure Automation with Event Grid and Microsoft Teams Create a virtual machine, which sends an event. The event triggers an Automation runbook that tags the virtual machine, and triggers a message that is sent to a Microsoft Teams channel.

Logic Apps

Use Logic Apps to implement business processes that process Event Grid events. You don't create a webhook explicitly in this scenario. When you configure the logic app to handle events from Event Grid, the webhook is created automatically. For examples, see the following tutorials:

Title Description
Tutorial: Monitor virtual machine changes with Azure Event Grid and Logic Apps A logic app monitors changes to a virtual machine and sends emails about those changes.
Tutorial: Send email notifications about Azure IoT Hub events using Logic Apps A logic app sends a notification email every time a device is added to your IoT hub.
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 example (for PUT)

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

See the Event handlers article for a list of supported event handlers.