anonymous user Thanks for reaching out. As per the error status-code: 401, status-description: Unauthorized TrackingId:XXXX-XXXXX the client (function app) was not able to authenticate the request for event hub. As per the sample it looks like you are using the Azure Event Hub SDK for sending the event and not the event hub output bindings.
I will suggest you to validate if you are passing the correct connectionString
and log the connectionString object to verify if the value was retrieved correctly. As you haven't shared the full code snippet/configuration, I am not sure how you can getting the connectionString.
In case as you have confirmed that it works locally and not when deployed in azure function so I believe you are getting the connection string from your local.setting.json file.
Please verify if the same configuration in local.setting.json file is reflected in the configuration blade of your function app.
If it is not the above case, then please share your sample code and configuration so I can review it.