Reputation: 28306
I'm trying to create some Azure Functions. I started by working through the tutorial here. The problem, I keep getting errors when I try to debug locally.
Here is my local.settings.json
:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=XYZ;AccountKey=<removed>;BlobEndpoint=https://XXX.blob.core.windows.net/;QueueEndpoint=https://XXX.queue.core.windows.net/;TableEndpoint=https://XXX.table.core.windows.net/;FileEndpoint=https://XXX.file.core.windows.net/;",
"AzureWebJobsDashboard": "",
"QueueStorage": "https://XXX.queue.core.windows.net/myqueue-items"
}
}
Here is the code (really just the templated code included for Azure Functions)
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp3
{
public static class SampleFunction
{
[FunctionName("SampleFunction")]
public static void Run([QueueTrigger("myqueue-items", Connection = "QueueStorage")]string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
}
}
}
Here is the output to the local console window:
[8/29/2017 5:53:01 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'SampleFunction.Run'. Microsoft.Azure.WebJobs.Host: Failed to validate Microsoft Azure WebJobs SDK QueueStorage connection string. The Microsoft Azure Storage account connection string is not formatted correctly. Please visit https://go.microsoft.com/fwlink/?linkid=841340 for details about configuring Microsoft Azure Storage connection strings.
[8/29/2017 5:53:01 PM] Error indexing method 'SampleFunction.Run'
[8/29/2017 5:53:01 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'SampleFunction.Run'. Microsoft.Azure.WebJobs.Host: Failed to validate Microsoft Azure WebJobs SDK QueueStorage connection string. The Microsoft Azure Storage account connection string is not formatted correctly. Please visit https://go.microsoft.com/fwlink/?linkid=841340 for details about configuring Microsoft Azure Storage connection strings.
I tried rewriting the connecting string a few times but can't seem to get rid of the error. I reviewed the information here but still can't get this to work.
What am I missing?
Upvotes: 3
Views: 2087
Reputation: 2726
As juunas said, we require the full connection string for Connection
app settings.
If this connection is a duplicate of AzureWebJobsStorage
, you can simply change your attribute to [QueueTrigger("my-queue-items")]
(AzureWebJobsStorage
is the default if no other connection is specified).
Upvotes: 1
Reputation: 58733
It looks like it expects a full Storage connection string there in settings instead of just the URL for the queue.
Something like:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=XYZ;AccountKey=<removed>;BlobEndpoint=https://XXX.blob.core.windows.net/;QueueEndpoint=https://XXX.queue.core.windows.net/;TableEndpoint=https://XXX.table.core.windows.net/;FileEndpoint=https://XXX.file.core.windows.net/;",
"AzureWebJobsDashboard": "",
"QueueStorage": "DefaultEndpointsProtocol=https;AccountName=XYZ;AccountKey=<removed>;BlobEndpoint=https://XXX.blob.core.windows.net/;QueueEndpoint=https://XXX.queue.core.windows.net/;TableEndpoint=https://XXX.table.core.windows.net/;FileEndpoint=https://XXX.file.core.windows.net/;"
}
}
Upvotes: 4