I'm using python v2 azure event grid output binding, using code from microsoft official documentation. I'm trying to use managed identity instead of the topic endpoint and keys. but here
@app.event_grid_output(
arg_name="outputEvent",
topic_endpoint_uri="MyEventGridTopicUriSetting",
topic_key_setting="MyEventGridTopicKeySetting")
what should be done here? I keep getting the below error
Unable to resolve the value for property 'EventGridAttribute.TopicEndpointUri'.
import logging
import azure.functions as func
import datetime
@app.function_name(name="eventgrid_output")
@app.route(route="eventgrid_output")
@app.event_grid_output(
arg_name="outputEvent",
topic_endpoint_uri="MyEventGridTopicUriSetting",
topic_key_setting="MyEventGridTopicKeySetting")
def eventgrid_output(eventGridEvent: func.EventGridEvent,
outputEvent: func.Out[func.EventGridOutputEvent]) -> None:
logging.log("eventGridEvent: ", eventGridEvent)
outputEvent.set(
func.EventGridOutputEvent(
id="test-id",
data={"tag1": "value1", "tag2": "value2"},
subject="test-subject",
event_type="test-event-1",
event_time=datetime.datetime.utcnow(),
data_version="1.0"))
To implement Event Grid Trigger Azure function using Managed Identity, you have to use the connection property.
Use the below function code:
local.settings.json:
EventGrid Contributor,EventGrid Data Senderto access Event Grid Topic at runtime when using Managed Identity.Send the events:
References:
https://learn.microsoft.com/en-gb/answers/questions/1615439/does-eventgrid-output-binging-v2-support-managed-i