Azure / azure-functions-python-library

Azure Functions Python SDK
MIT License
147 stars 61 forks source link

Added eventgrid connection property #229

Closed gavin-aguiar closed 2 weeks ago

gavin-aguiar commented 2 weeks ago

Added connection property to the eventgrid trigger.

Connection property is needed to use MI with eventgrid. Ref: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-grid-output?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cextensionv3&pivots=programming-language-python#identity-based-authentication

Event grid output binding decorator will have a connection arg. Function app can now have connection or a combination of TopicKeySetting and TopicEndpointUri but not both.

@app.event_grid_output(
    arg_name="outputEvent",
    topic_endpoint_uri="AzureWebJobsEventGridTopicUri",
    topic_key_setting="AzureWebJobsEventGridConnectionKey")

OR


@app.event_grid_output(
    arg_name="outputEvent",
    connection="AzureWebJobsEventGridTopicUri")

Fixes: https://github.com/Azure/azure-functions-python-worker/issues/1501