Azure Function V3 .Net Core

Hassan Shabbir 6 Reputation points
2022-02-28T15:37:22.497+00:00

Hello,
i just upgraded my azure function V1 to V3(Core), I am getting some problem with connection string.
Here is function sample

   [FunctionName("Function1")]  
        public static void Run([IoTHubTrigger("messages/events", Connection = "ConnectionStrings:IoTHubEndpoint")] EventData message, ILogger log)  
        {  
            log.LogInformation($"C# IoT Hub trigger function processed a message: {Encoding.UTF8.GetString(message.EventBody.ToArray())}");  
        }  

I am Getting this error
178554-apperror.png

Here is local.settings.json file.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
},
"ConnectionStrings": {
"IoTHubEndpoint": "mystring"
}
}

Getting this string from here

178555-image.png

Someone guide me please what i am doing wrong here ?

Thank you so much for your response.

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

Azure IoT Hub
Azure IoT Hub

An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    7 deleted comments

    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    2 deleted comments

    Comments have been turned off. Learn more

  3. MughundhanRaveendran-MSFT 12,511 Reputation points
    2022-03-01T05:52:12.047+00:00

    @Hassan Shabbir ,

    Thanks for reaching out to Q&A.

    The connection string should be passed in this way Connection = "IoTHubEndpoint". Create a name value pair in the local.settings.json file with the name "IoTHubEndpoint" and connection string obtained from the portal as value.

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.