Azure / azure-functions-eventhubs-extension

Event Hubs extension for Azure Functions
MIT License
20 stars 26 forks source link

IoT Hub output binding as Event Hub doesn't work #80

Closed horihiro closed 3 years ago

horihiro commented 3 years ago

I tried IoT Hub output binding from Node.js function as following documentation. https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-iot-output?tabs=javascript

But following error shows and the function is failed.

Unauthorized access. 'Send' claim(s) are required to perform this operation

image

It seems that a connection string, which starts with Endpoint=sb:// ... and was set when adding the binding from portal, doesn't have enough permission.

Is this binding supported currently? # documentation says this is supported. If this is supported, could you please let me know how to get appropriate connection string?

# As long as I know, EventHubs extention is used for IoT Hub binding, so I filed to this repo. Please let me know if this is wrong.

horihiro commented 3 years ago

According to following documetation of IoT Hub, it seems that the built-in Event Hub endpoint in IoT Hub is for only event reading, not writing.

https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-builtin#read-from-the-built-in-endpoint

So if the output binding uses the built-in endpoint, I suspect the binding cannot write event.

horihiro commented 3 years ago

Hello @soninaren , could you please look into this?

phooey commented 3 years ago

Hello @soninaren , could you please look into this?

I'm interested too, I have confirmed the same issue.

hromanko commented 3 years ago

Yes this would be the expected behaviour on attempting to publish to an IotHub EventHub endpoint as they are read only. I'm not sure if there is an connection string or identity that would solve the issue OR if the documentation is incorrect. I can confirm the same result and would be interested in any solution or update on this ticket. Thanks!

soninaren commented 3 years ago

The IotHub template is actually an alias for eventHub Trigger. The function expected eventhub connection string with manage permissions. The messages are read from eventhub directly. Functions runtime does not connect to the IotHub directly.

ghost commented 3 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.