I have an issue to create an Azure Function with Queue Trigger in .NET core 2.0.
What I want
In a microservice architecture, when a new message is created in a queue for creating a user, a service has to receive this message and creates a user in a database based on the information in it.
Issue
In Visual Studio 2017 I create a new project under Azure Function.
From the New Template I select Queue Trigger.
This screen is different from a Microsoft post about this subject. Anyway, first issue is what Connection and Path are.
I created a Service Bus and I have my credential from Azure Portal. I copied Primary Connection String and Path is the name of my queue.
If I run the project, I receive a lot of errors. I found this link on Azure Documentation for a simple trigger. In this example they use ServiceBusTrigger instead of QueueTrigger. For resolving ServiceBusTrigger, I added Microsoft.Azure.WebJobs.ServiceBus from Nuget. It seems it doesn't work.
To have the right credential for my Azure Function, I created one in Azure Portal and downloaded the app content.
It looks like
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_EXTENSION_VERSION": "beta",
"ScmType": "None",
"WEBSITE_AUTH_ENABLED": "False",
"AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=my;AccountKey=something",
"WEBSITE_NODE_DEFAULT_VERSION": "6.5.0",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "DefaultEndpointsProtocol=https;AccountName=my;AccountKey=something",
"WEBSITE_CONTENTSHARE": "createprofile-98873b60",
"WEBSITE_SITE_NAME": "CreateProfile",
"WEBSITE_SLOT_NAME": "Production",
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=createprofil8796;AccountKey=something"
},
"configurationSource": "config",
"bindings": [
{
"type": "serviceBusTrigger",
"connection": "sb://myservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=something",
"queueName": "testqueue",
"accessRights": "manage",
"name": "myQueueItem",
"direction": "in"
}
]
}
This is the error page I have
Warning: Cannot find value named 'https://MyDevServiceBus.servicebus.windows.net' in local.settings.json that matches 'connection' property set on 'queueTrigger' in 'C:\Projects\CustomerProfile.AzureService\bin\Debug\netstandard2.0\Function1\function.json'. You can run 'func azure functionapp fetch-app-settings ' or specify a connection string in local.settings.json. [12/03/2018 12:10:41] Reading host configuration file 'C:\Projects\CustomerProfile.AzureService\bin\Debug\netstandard2.0\host.json' [12/03/2018 12:10:41] Host configuration file read: [12/03/2018 12:10:41] { [12/03/2018 12:10:41] } [12/03/2018 12:10:42] Generating 1 job function(s) [12/03/2018 12:10:42] Starting Host (HostId=desktop7fksikf-631144646, Version=2.0.11353.0, ProcessId=8992, Debug=False, Attempt=0, FunctionsExtensionVersion=beta) Listening on http://localhost:7071/ Hit CTRL-C to exit... [12/03/2018 12:10:42] A ScriptHost error has occurred [12/03/2018 12:10:42] Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host: Microsoft Azure WebJobs SDK 'QueueConnection' connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways: [12/03/2018 12:10:42] 1. Set the connection string named 'AzureWebJobsQueueConnection' in the connectionStrings section of the .config file in the following format , or [12/03/2018 12:10:42] 2. Set the environment variable named 'AzureWebJobsQueueConnection', or [12/03/2018 12:10:42] 3. Set corresponding property of JobHostConfiguration. [12/03/2018 12:10:42] Error indexing method 'Function1.Run' [12/03/2018 12:10:42] Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host: Microsoft Azure WebJobs SDK 'QueueConnection' connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways: [12/03/2018 12:10:42] 1. Set the connection string named 'AzureWebJobsQueueConnection' in the connectionStrings section of the .config file in the following format , or [12/03/2018 12:10:42] 2. Set the environment variable named 'AzureWebJobsQueueConnection', or [12/03/2018 12:10:42] 3. Set corresponding property of JobHostConfiguration. [12/03/2018 12:10:42] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.). [12/03/2018 12:10:42] Job host started [12/03/2018 12:10:42] The following 1 functions are in error: [12/03/2018 12:10:42] Run: Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host: Microsoft Azure WebJobs SDK 'QueueConnection' connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways: [12/03/2018 12:10:42] 1. Set the connection string named 'AzureWebJobsQueueConnection' in the connectionStrings section of the .config file in the following format , or [12/03/2018 12:10:42] 2. Set the environment variable named 'AzureWebJobsQueueConnection', or [12/03/2018 12:10:42] 3. Set corresponding property of JobHostConfiguration. [12/03/2018 12:10:42] [12/03/2018 12:10:42] [12/03/2018 12:10:42] Host lock lease acquired by instance ID '000000000000000000000000E37F5049'.
What is the correct implementation of this kind of Azure Function? Is there any example on GitHub? Thanks in advance.






Microsoft.Azure.WebJobs.ServiceBusfrom here myget.org/feed/azure-appservice/package/nuget/… - Ihor Korotenko