Hello Claude VERNIER ,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that your are facing issues with an Azure Function triggered by a Service Bus queue, both locally and on Azure. The local environment fails to trigger the function, while the Azure deployment encounters a listener startup failure. Despite correct configurations and connectivity to the Service Bus, the function fails to start, indicating potential configuration mismatches or compatibility issues between the local and Azure environments.
To solve this issues:
Open the local.settings.json file and ensure that the Service Bus connection string under the "POC_BUS" key is correct. Verify that all necessary dependencies and configurations are correctly set up in the Azure Function project. Below is an example of how you might configure the local.settings.json file for an Azure Function triggered by a Service Bus queue:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"POC_BUS": "Endpoint=sb://your-service-bus-namespace.servicebus.windows.net/;SharedAccessKeyName=YourSharedAccessKeyName;SharedAccessKey=YourSharedAccessKey"
}
}
Replace "YourServiceBusConnectionString" with your actual Service Bus connection string.
Secondly, add logging statements within the function code using a logging framework like Serilog or Microsoft.Extensions.Logging. Run the Azure Function project in debug mode using Visual Studio and analyze the logs to identify any potential issues with function execution.
Thirdly, verify permissions granted to your account and the Azure Function managed identity for accessing the Service Bus. Compare the Azure Function App's configuration with the local.settings.json file to ensure consistency, especially regarding the Service Bus connection string.
Finally, use Azure Service Bus Explorer or similar tools to verify connectivity to the Service Bus namespace from both local and Azure environments. Ensure that the Service Bus queue or topic is correctly configured to trigger the Azure Function.
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please remember to "Accept Answer" if answer helped, so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam