@Sergio Solorzano Thanks for reaching out. I couldn't reproduce the issue at my end. I have used .NET Core 3.1 along with the latest Azure.Messaging.EventGrid v4.12.0 on Visual Studio 2022. I have used the same code that you have shared, and the function execution was successful, and the event was sent correctly to the event grid topic.
I can only see two values that you are necessary in your above code along with any of the data machinePartTransformTelemetry that you are passing. Please revalidate if they are correct and log the individual values in case if you are getting it from configuration to make sure that the value is passing correctly.
- Your variable should have the endpoint value correctly (https://{eventgridtopicname}.{region}-{number}.eventgrid.azure.net/api/events). You can navigate to your event grid topic overview page and check property value of
Topic Endpoint - You have already verified the key value as you have mentioned but please make sure that there is no special character, and the value is retrieved correctly for eventGridTopic_Key variable.
In case you still observe the same behavior then I can connect with you offline to assist you further.
**Update: **
The exception was caused by a log statement in the try statement and not related to event grid code.