C#C
C#10mo ago
Tostisto

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:

[Function(nameof(test))]
public async Task Run([ServiceBusTrigger("queue", Connection = "ServiceBus:ConnectionString")] ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions)
{
    try
    {
        // Some logic here

        await messageActions.CompleteMessageAsync(message);
    }
    catch (Exception)
    {
        await messageActions.AbandonMessageAsync(message);
    }
}


Am I able to load the connection string to servicebus from inmemory configuration?
Thanks for every response.
Was this page helpful?