First off, this is probably not the (fully) correct location but I should be 90% of the way there.
Today I was attempting to create a Azure function that connects to the IoT Hub. However after the deployment I got the following error message.
Azure.Messaging.EventHubs: The path to an Event Hub may be specified as part of the connection string or as a separate value, but not both. Please verify that your connection string does not have the `EntityPath` token if you are passing an explicit Event Hub name. (Parameter 'connectionString').
Steps to reproduce.
Create a IoT Hub
Create a .net 6 (non-isolated), windows backed Function app.
In the function app create a new function.
Set "development environment" to portal.
Select the "IoT Hub (Event Hub)" template.
Select the Event hub connection (create one of it does not exist).
Select Create.
If you try to run this function app, you'll get the above error.
In order to fix this error you have to open the "function.json" file, set the "eventHubName" from "samples-workitems" to the value provided by the IoT Hub under "Build-in endpoints"->"Event Hub Details"->"Event Hub-compatible name".
In my opinion would it be great if the template looks like this
//Be sure to update te eventHubName in function.json to the Event Hub-compatible name listed in the IoT Hub
//This can be found under Build-in endpoints > Event Hub Details
using System;
public static void Run(string myIoTHubMessage, ILogger log)
{
log.LogInformation($"C# IoT Hub trigger function processed a message: {myIoTHubMessage}");
}
That way the user at least knows what they have to do in case thy run into issues.
First off, this is probably not the (fully) correct location but I should be 90% of the way there.
Today I was attempting to create a Azure function that connects to the IoT Hub. However after the deployment I got the following error message.
Steps to reproduce.
If you try to run this function app, you'll get the above error.
In order to fix this error you have to open the "function.json" file, set the "eventHubName" from "samples-workitems" to the value provided by the IoT Hub under "Build-in endpoints"->"Event Hub Details"->"Event Hub-compatible name".
In my opinion would it be great if the template looks like this
That way the user at least knows what they have to do in case thy run into issues.
[Edit] Also see this article as my source
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.