2
votes

I have created new Azure Function for QueueTrigger but after running it locally getting some weird error below.

Function1.cs

public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([QueueTrigger("demoqueue", Connection = "DefaultEndpointsProtocol=myconnectionstring")]string myQueueItem, TraceWriter log)
        {
            log.Info($"C# Queue trigger function processed: {myQueueItem}");
        }
    }

local.setting.json

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "AzureWebJobsDashboard": "UseDevelopmentStorage=true"
    }
}

Error -

[11/14/2018 4:36:15 PM] The following 1 functions are in error: [11/14/2018 4:36:15 PM] Run: Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host: Microsoft Azure WebJobs SDK '[Hidden Credential]' connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways: [11/14/2018 4:36:15 PM] 1. Set the connection string named '[Hidden Credential]' in the connectionStrings section of the .config file in the following format , or [11/14/2018 4:36:15 PM] 2. Set the environment variable named '[Hidden Credential]', or [11/14/2018 4:36:15 PM] 3. Set corresponding property of JobHostConfiguration.

1

1 Answers

4
votes

You need to specify the key of the app setting where your connection string is stored in the config not the connectionstring itself.

public static void Run([QueueTrigger("demoqueue", Connection = "NameOfYourAppSetting")]