5

I have a function app defined like

[StorageAccount("DefaultEndpointsProtocol=...;AccountName=…;AccountKey=...")]
public static class Function1
{
    [FunctionName("Function1")]
    [return: Queue("lets-test-this-out")]
    public static async Task<string> Run([QueueTrigger("lets-test-this-in")] Guid  guid, TraceWriter log)
    {
        await Task.Delay(1000);
        log.Info($"C# Queue trigger function processed: {guid}");
        return Guid.NewGuid().ToString();
    }
}

where lets-test-this-in and lets-test-this-out are the name of existing storage queues under the storage account with connection string "DefaultEndpointsProtocol=...;AccountName=…;AccountKey=..." (copied straight from Access keys - Connection string in the portal). My generated function.json when I publish is like

{
  "generatedBy": "Microsoft.NET.Sdk.Functions.Generator-1.0.6",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "queueTrigger",
      "queueName": "lets-test-this-in",
      "connection": "DefaultEndpointsProtocol=...;AccountName=...;AccountKey=...;",
      "name": "guid"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/FunctionAppTest.dll",
  "entryPoint": "FunctionAppTest.Function1.Run"
}

which the only thing suspicious about that is I don't see [return: Queue("lets-test-this")] being translated to any value there.

Anyways, this isn't working:

  • When I try to test the function in the portal, I see Status: 202 Accepted, but nothing is logged in the output pane.
  • When I drop a message in lets-test-this-in, it does not get picked up.
  • Streaming logs will say [Info] Executing HTTP request and then nothing.

Interestingly though, if I re-publish after removing the [StorageAccount] attribute then I can test in the portal and see in Streaming logs that it is still being executed.

Possibly related is that my local.settings.json is like

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

1 Answer 1

1

StorageAccount attribute accepts a name of Application Setting where the connection string is placed, not the connection string itself. E.g.

[StorageAccount("AzureWebJobsStorage")]

Output bindings are not shown in generated function.json - that's confusing but expected.

Sign up to request clarification or add additional context in comments.

3 Comments

Actually, the documentation for the Parameters says - Can be an app setting or connection string name of your choosing as one of three possibilities
@SeeSharp Mikhail is right, please refer to function document.
@SeeSharp Yes, and yours is neither app setting name, nor connection name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.