admin管理员组文章数量:1125036
I'm trying to get my Function App Servicebus Queue Trigger to be used with the parameters for queue name and connection string fetched from App configuration Service in Azure.
My setup works for fetching and my configuration in the application context seems to get populated correctly but for some reason my Function App Servicebus queue trigger doesn't bind correctly with the name of the setting. I still get a:
The listener for function 'Functions.MessageHandler' was unable to start. Microsoft.Azure.WebJobs.Extensions.ServiceBus: Service Bus account connection string 'PartFinder:Servicebus:ConnectionString' does not exist. Make sure that it is a defined App Setting.
Error message when running my app locally. This lead me to read up a bit more around the web and I found these Links:
How to use Azure App Configuration Service with Azure Functions in local dev environment?
Isolated azure function with service bus trigger - connection string from azure app configuration
How to use Azure App Config Service with Azure Functions for binding input parameters
If I understood this correctly, this is not yet possible, So I Defaulted back to having App config references set to the correct App Configs in the App Config service in the Azure function app namespaces settings instead using this method:
App Configuration Service Referencing Syntax
But just to make sure I haven't missed anything...Does anyone know if what is claimed in the links above is relevant today? Have this issue or rather the support for App Configuration settings referencing directly to function Servicebus Queue trigger parameters been solved from Microsoft's side yet?
I'm trying to get my Function App Servicebus Queue Trigger to be used with the parameters for queue name and connection string fetched from App configuration Service in Azure.
My setup works for fetching and my configuration in the application context seems to get populated correctly but for some reason my Function App Servicebus queue trigger doesn't bind correctly with the name of the setting. I still get a:
The listener for function 'Functions.MessageHandler' was unable to start. Microsoft.Azure.WebJobs.Extensions.ServiceBus: Service Bus account connection string 'PartFinder:Servicebus:ConnectionString' does not exist. Make sure that it is a defined App Setting.
Error message when running my app locally. This lead me to read up a bit more around the web and I found these Links:
How to use Azure App Configuration Service with Azure Functions in local dev environment?
Isolated azure function with service bus trigger - connection string from azure app configuration
How to use Azure App Config Service with Azure Functions for binding input parameters
If I understood this correctly, this is not yet possible, So I Defaulted back to having App config references set to the correct App Configs in the App Config service in the Azure function app namespaces settings instead using this method:
App Configuration Service Referencing Syntax
But just to make sure I haven't missed anything...Does anyone know if what is claimed in the links above is relevant today? Have this issue or rather the support for App Configuration settings referencing directly to function Servicebus Queue trigger parameters been solved from Microsoft's side yet?
Share Improve this question asked 2 days ago H4p7icH4p7ic 1,8913 gold badges37 silver badges72 bronze badges 1- Please provide your app configuration. – Pravallika KV Commented yesterday
2 Answers
Reset to default 0We had exact same issue last year when debugging locally. In the end, we put the service bus connection details in the local.settings.json (this file is not checked in)
Wonder if you can test out your setup just to be 100% sure that nothing has changed..:
test 1- "having App config references set to the correct App Configs in the App Config service in the Azure function app namespaces settings": this should work on app service
test 2- pulling settings from Azure App Configuration in at runtime of your function. this should work on app service but probably will still fail locally (due to the limitation: worker configuration sources are not currently supported by extensions/bindings, as that configuration must be available at the app/platform level (platform components depend on that configuration).
As of JAN 2025, it is still not supported to implement Azure App Configuration with Service Bus trigger Isolated Azure function. Refer the response provided by @fabiocav in GitHub.
I got the same error when I tried to fetch connection string from Azure App Configuration.
You have to add the Connection String and Queue name as the application setting in Function app's configuration (or) local.settings.json
.
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"FunctionsConfiguration:ServiceBusQueueTrigger:Connection": "<Service_Bus_connection>",
"FunctionsConfiguration:ServiceBusQueueTrigger:Queue": "<ServiceBus_Queue_Name",
}
}
Function.cs:
[Function(nameof(Function1))]
public async Task Run([ServiceBusTrigger("%FunctionsConfiguration:ServiceBusQueueTrigger:Queue%", Connection = "FunctionsConfiguration:ServiceBusQueueTrigger:Connection")]ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions)
{
_logger.LogInformation("Message ID: {id}", message.MessageId);
_logger.LogInformation("Message Body: {body}", message.Body);
_logger.LogInformation("Message Content-Type: {contentType}", message.ContentType);
await messageActions.CompleteMessageAsync(message);
}
Able to run the Service Bus trigger as expected:
Output:
Functions:
Function1: serviceBusTrigger
For detailed output, run func with --verbose flag.
[2025-01-10T12:24:51.269Z] Host lock lease acquired by instance ID '0000000000000000000000000C237F69'.
[2025-01-10T12:25:32.550Z] Executing 'Functions.Function1' (Reason='(null)', Id=4adf5f29-7c2d-47c0-b267-13ef26df9b63)
[2025-01-10T12:25:32.554Z] Trigger Details: MessageId: 8496e0942a35481eb545dec1f80fbd54, SequenceNumber: 1, DeliveryCount: 1, EnqueuedTimeUtc: 2025-01-10T12:25:30.6990000+00:00, LockedUntilUtc: 2025-01-10T12:26:30.9490000+00:00, SessionId: (null)
[2025-01-10T12:25:32.925Z] Message ID: 8496e0942a35481eb545dec1f80fbd54
[2025-01-10T12:25:32.928Z] Message Body: Hello World
[2025-01-10T12:25:32.932Z] Message Content-Type: (null)
[2025-01-10T12:25:33.012Z] Start processing HTTP request POST [http://127.0.0.1:59040/Settlement/Complete](http://127.0.0.1:59040/Settlement/Complete "http://127.0.0.1:59040/settlement/complete")
[2025-01-10T12:25:33.022Z] Sending HTTP request POST [http://127.0.0.1:59040/Settlement/Complete](http://127.0.0.1:59040/Settlement/Complete "http://127.0.0.1:59040/settlement/complete")
[2025-01-10T12:25:33.543Z] Received HTTP response headers after 495.5078ms - 200
[2025-01-10T12:25:33.551Z] End processing HTTP request after 567.419ms - 200
[2025-01-10T12:25:33.596Z] Executed 'Functions.Function1' (Succeeded, Id=4adf5f29-7c2d-47c0-b267-13ef26df9b63, Duration=1087ms)
As an alternative, you can also use App Configuration reference.
本文标签:
版权声明:本文标题:appsettings - Azure Function Servicebus Queue Trigger Parameters From Azure App Configuration Service - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736652005a1946161.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论