Thank you for adding more information in the comments of my other answer. I reproduced the error, it's not something you did, it's an error in the Azure Portal! To fix it, follow these steps:
1. Go to the Configuration of your Function.
In your Function app, select Configuration on the left (under Settings). You will see the application settings of your function. Locate the key that has your IoT Hub name and the _events_IOTHUB suffix. (e.g. if your hub is named best-hub-ever
, look for the key best-hub-ever_events_IOTHUB
.
Click on the Edit icon, you need to copy the text after ;EntityPath=
. (The key is best-hub-ever
in the screenshot)
2. Go to your **Function (select Functions, then your Function) and go the Code + Test screen.**
You will see a dropdown, click on it and select function.json
When you do, you will notice the configuration is incorrect. The eventHubName
is set to samples-workitems
. Change this value to the value you copied in step 1. Click on save.
Hit save, restart the Function App for good measure, everything should be working again.