Azure function connection string from azure app configuration store
Hello, I need some help. I have an Azure Function that is triggered by a Service Bus queue message. One of the parameters is the connection string to the Service Bus. My problem is that I am using Azure App Configuration Store to store shared connection strings between apps.
The connection strings are stored in the configuration in-memory like this:
configuration = configuration.AddInMemoryCollection(config);
However, there is a problem when I try to run the app. The Azure Function is not able to read the connection string from the configuration, and I am getting this error: Service Bus account connection string with name ServiceBus:ConnectionString
The function looks like this:
Am I able to load the connection string to servicebus from inmemory configuration?
Thanks for every response.33 Replies
Which version of Azure Functions is that?
Isolated?
Yes, isolated v4
@TeBeCo We were looking into this stuff a few weeks ago, do you remember the correct setup right away?
I think the issue was related to config on the host vs on the worker and where the config binds towards
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Ah, right, that was the solution we ended up with back then, you added the json explicitly I think
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
@Tostisto Bottom line, if I recall correctly, we were also struggling with getting the actual worker to accept dynamic configuration, it's really hard to tell which process you actually end up configuring. I think the right way to pass configurations to your worker is by using local settings json locally, and env variables on Azure
Does it work if you add the connectionstring in your json config instead of in memory?
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
I had no problem when I am using only
AddUserSecrets<T>
. Also when i am using the memory i can acces the values but I can not use this in azure function connection string trigger.
yes it match
Also i am a little bit special and the key in the app configuration store are separated by __
some i have for example servicebus_connectionstring
and in am parsing it into servicebus:connectionstring
I tried to use the AddJsonStream
but it does not helpUnknown User•2mo ago
Message Not Public
Sign In & Join Server To View
this is what i have
the json use the
:
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
yes
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
yes that is in ideal word. but i have the key in the appconfiguration like this
ServiceBuses__ConnectionString
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
so i need to replace
__
to :
and then the connection in the function will be like ServiceBuses:ConnectionString
but this is not working at allUnknown User•2mo ago
Message Not Public
Sign In & Join Server To View
I can not change that value in appconfiguration
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Not at all. The my mess code that i send you replace the
__
to :
, then create json and load as a json. but then i have still the error Service Bus account connection string with name ServiceBus:ConnectionString
😄Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
I do not mean value, but the key.
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
And it is from historical puposes
thats because why i have some__some
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Ok, Thanks, i will try find better solution for that
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
[2025-03-20T20:16:55.036Z] The 'EventLoggerFunction' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.EventLoggerFunction'. Microsoft.Azure.WebJobs.Host: '%ServiceBuses:ConnectionString%' does not resolve to a value.
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
now local
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
Yes, this works
The function work correctly, because we uses the environment variables before. but not we migrate to app configuration store and this happened