azure-functions-dotnet-worker: Is ServiceBusTrigger supported at all?

[FunctionName("ServiceBusTest")]
public static async Task ServiceBusTest(
    [ServiceBusTrigger("qwerty", Connection = "MyConnectionString")] string message)
{ }

throws “Microsoft Azure WebJobs SDK ServiceBus connection string ‘MyConnectionString’ is missing or empty.” before Main() is called so I have no way of providing a connections string.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 24 (9 by maintainers)

Most upvoted comments

Any news regarding this?

Creating a dotnetisolated .NET 5.0 azure function with a ServiceBusTrigger, is it still true that I can’t reference my local user-secrets store when filling in the connectionstring?

When running in Azure, KeyVault reference is good, but for running locally on my devmachine I want to reference the local connectionstring that I have set in user-secrets.

@Mithras opening an issue to investigate the problem with service bus

For the trigger configuration, that is an expected limitation at the moment. As you found, the configuration in the worker applies to that context only and what gets applied in the host doesn’t have any access to that. Will also open an issue to track.

I think @anthonychu may have been tweeting about a similar case. I believe we have validation right now that is a bit too strict to throw when we don’t see a key/value in local.settings.json. I assume you’ve set up some configuration pipeline to load the secrets from key vault during startup, you may just have to put a placeholder value in local.settings.json to get around the validation for now? Not positive.

I agree, seems like quite the step back. Can’t use app config either. To run locally this is a real problem.

@fabiocav I think it’s the same issue. Host and user process don’t have to use the same configuration but we need some extension point to be able to provide secrets to the host. Something as simple as a class with some attribute will do. Similar to [assembly: WebJobsStartup(typeof(Startup))] or [assembly: FunctionsStartup(typeof(Startup))]

No, I don’t think it works. I put a mock connections string to local.settings.json and I’m seeing hundreds of image before Main() is called. It seems current preview is trying to setup all triggers before calling Main().