title | description | author | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|
Azure Functions Event Grid local debugging |
Learn to locally debug Azure Functions triggered by an Event Grid event |
craigshoemaker |
conceptual |
10/18/2018 |
cshoe |
This article demonstrates how to debug a local function that handles an Azure Event Grid event raised by a storage account.
- Create or use an existing function app
- Create or use an existing storage account. Event Grid notification subscription can be set on Azure Storage accounts for
BlobStorage
,StorageV2
, or Data Lake Storage Gen2. - Download ngrok to allow Azure to call your local function
Open your function app in Visual Studio and, right-click on the project name in the Solution Explorer and click Add > New Azure Function.
In the New Azure Function window, select Event Grid trigger and click OK.
Once the function is created, open the code file and copy the URL commented out at the top of the file. This location is used when configuring the Event Grid trigger.
Then, set a breakpoint on the line that begins with log.LogInformation
.
Next, press F5 to start a debugging session.
[!INCLUDE functions-event-grid-local-dev]
Once the Event Grid recognizes a new file is uploaded to the storage container, the break point is hit in your local function.
To clean up the resources created in this article, delete the test container in your storage account.