Configure ServiceBusTriggerAttribute from AppSettings
See original GitHub issueI’m developing an application where the infrastructure is completely deployed with ARM. I create the service bus / the topic / the subscription with it also.
In my azure functions, I set the app settings for the service bus with ARM also.
Currently only the Connection parameter parameter looks in app settings.
Since the Attribute is sealed and it wants constant parameters there is no way to fix this.
[FunctionName("MyFunction")]
public static void Run(Run([ServiceBusTrigger("MyTopic", "MySubscription", AccessRights.Listen, Connection = "ConnectionString")]BrokeredMessage mySbMsg, TraceWriter log)
It would be nice to have MyTopic & MySubscription fetched from AppSettings like the ConnectionString
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
ServiceBusTrigger: local.settings to "cloud" settings
1 Answer 1 · tnx, I know local.settings. · Another problem is that we also tried (as workaround) to add an appsettings.json in...
Read more >Azure Service Bus trigger for Azure Functions
For information on setup and configuration details, ... use the ServiceBusTriggerAttribute attribute to define the function trigger.
Read more >Azure Functions with Azure Service Bus
ServiceBusTriggeredEndpointConfiguration loads certain configuration values from the Azure Function host environment in the following order:.
Read more >Untitled
The following screenshot demonstrates these three app settings in use: Step ... at computer chip Configure ServiceBusTriggerAttribute from AppSettings #1221 ...
Read more >Untitled
Code for local.settings.json where the Service Bus connection string is set. ... and subscribers Configure ServiceBusTriggerAttribute from AppSettings #1221 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Been in the same boat. It is already done.
Have a look at this sample function here and in the AnalyseImage.cs file at the trigger attribute:
In the QueueTrigger, the ‘%’ is specifying that it wants to be resolved from a setting. This will look (when deployed on azure) at the WebApp settings you can set via arm. When running functions locally, they are defined in the local.settings.json as you can see in the sample app, that the queue-name has been assigned there.
In the ARM template, as normal, resolve and apply the values as settings in the web app properties with the same name as you use for the config setting in local.settings.json, which is the same as between the %'s
In my case i have config for keyvault loaded first, then I have to load keyvault, then I have to deserialize my credentials from keyvault and only then I can have the service bus connection string to bind to. It took me a bit of time to get it right, but here’s the solution in case someone else runs into same issue. Hope it helps someone!
Now when setting up the binding for the function I can reference the new environment variable
local.settings.json NOTE: You will get a warning on build/run that ServiceBusConnectionString doesn’t exist in local.settings.json