-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
How can I use Azure App Configuration for QueueTrigger bindings? #9598
Comments
Thanks for informing . public static class ConfigurationSingleton
} [Function("foo")] |
No. I want the connection string to come from the attribute whereby the connection string 'should' come from my App Configuration using that name. |
This is just a lead: I remember reading that Event-based scaling doesn't allow dynamic elements in the function signature, all queues, databases, etc need to be hardcoded, constant, or app setting reference. |
@gvajda thanks for the replay. Not to nit-pick, but (in my view), it is an 'app setting', just that the setting is put in an Azure Configuration. I am able to resolve other configuration settings in this way, just not in an attribute definition. Sadly, this makes using 'Bicep' as a deployment tool almost useless (in my case). |
@gpuchtel 'app settings' in Azure Function App context means a very specific thing, it's not a matter of opinion. If you want to use dynamic values (including values fetched from App Config and cached in fnapp memory) then my answer applies. Unclear how this relates to bicep. |
This just seems like a security and maintenance issue. I will admit I haven't looked to see how or if it is possible to point to a specific Queue connection string using a service principal. I want all my connection information stored in 1 place. Azure App Config and there a pass through to Key Vault using the Identity my App Config service is configured with.
It really seems like I should be able to setup I even tried something crazy like this: var apiConfiguration = new ConfigurationBuilder().AddMyStandardAppConfig(
new ConfigurationBuilder()
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.Build()
)
.Build();
apiConfiguration["AzureWebJobsStorage"] = apiConfiguration.GetValue<string>("Attachments:ConnectionString");
apiConfiguration["AzureWebJobsAttachmentsConnectionString"] = apiConfiguration.GetValue<string>("Attachments:ConnectionString");
apiConfiguration["AttachmentsQueueName"] = apiConfiguration.GetValue<string>("Attachments:Queue");
var builder = FunctionsApplication.CreateBuilder(args);
var funcConfiguration = new ConfigurationBuilder()
.AddConfiguration(apiConfiguration)
.AddConfiguration(builder.Configuration)
.Build();
builder.Services.Replace(ServiceDescriptor.Singleton<IConfiguration>(funcConfiguration)); Then in my function I have public void UploadAttachment([QueueTrigger("%AttachmentsQueueName%", Connection = "AttachmentsConnectionString")] QueueMessage message) I tried the replace Singleton as I saw other places where it looked like it worked. I am running .NET 9 isolate-function. I am very sad that this just doesn't work. I was actually trying to step through the .NET function builder code and see if I could find where this is happening and override that part. I still might try, but I have wasted days on this already. I miss the old name resolver from the first WebJobs SDK. |
Library name and version
Microsoft.Azure.Functions.Worker 1.19.0
Query/Question
I've been searching for a way to use Azure 'App Configuration' to store the connection string of an Azure Storage Queue. After hours searching on the Web I'm even more confused--there seems to be conflicting opinions on how to do this. Maybe even using Managed Identity, but that makes debugging locally a nightmare.
What I want is something like this:
[Function("foo")
public void foo([QueueTrigger("bar", Connection = "FooConnection")] QueueMessage message)
Where "FooConnection" is the name of a 'key' in an Azure App Configuration from which the connection string is specified. adly, it seems that Azure only looks in the 'Configuration' of the function (or local settings if running locally).
So, is this even possible?
Note: I do 'AddAzureAppConfiguration(..) in my HostBuilder.
Thanks in advance,
I've tried to surround the name with '%' like "%FooConnection%", but I get an error saying the expression did not evaluate to a value.
I've seen posts that speak so an expression pattern, but there is not much guidance on it.
see: https://stackoverflow.com/q/77180419/8307483
The text was updated successfully, but these errors were encountered: