開始使用免費開始

從 Event Grid 觸發 Azure Function

Cipher Coffee 想在每次有新的 blob 上傳時,立即執行後續自動化流程。你將把 Azure Event Grid 連接到一個預先建立的 Azure Function,讓它在建立 blob 當下直接被呼叫,然後驗證函式是否收到事件承載(payload)。

本練習屬於課程

開發 Azure Storage

檢視課程

練習說明

在你的 Function App 中新增一個名為「OnBlobCreated」的「Azure Event Grid trigger」函式。,在該 Storage 帳戶上建立一個 Event Subscription,名稱為「blob-created-to-function」,System Topic Name 為「function-events-topic」,目標為「OnBlobCreated」函式,並且只篩選「Blob Created」事件類型。,建立名為「events-in」的容器,並上傳一個 blob 以觸發事件。,在 Monitor 中確認函式已被觸發,並於記錄中看到 Microsoft.Storage.BlobCreatedScreenshot showing an Event Grid subscription on a Storage account targeting an Azure Function endpoint named OnBlobCreated, plus a successful function invocation in Monitor with eventType Microsoft.Storage.BlobCreated.

動手互動練習

將理論付諸實踐,立即體驗我們的互動練習

開始練習