Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article demonstrates how to debug a local function that handles an Azure Event Grid event raised by a storage account.
Prerequisites
- 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
Create a new 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.
Debug the function
Once the Event Grid recognizes a new file is uploaded to the storage container, the break point is hit in your local function.
Clean up resources
To clean up the resources created in this article, delete the test container in your storage account.