Executable Azure Function not correctly load environments #5580
Replies: 3 comments
-
@petrkasnal - we have a lot of work to do in order to enable Azure Functions + Aspire. There will need to be changes both in Aspire and in Azure Functions. See #920 as well. |
Beta Was this translation helpful? Give feedback.
-
@petrkasnal Yep -- as @eerhardt mentioned there's some subtleties to sort out with the way that the Azure Functions host and worker consume connection strings so some additional work is required to make Out of curiousity: can you share what types of resources you are trying to inject into your worker? Are you just trying to get things working with the Azure Storage instance that the host needs or are you trying to consume Azure Service Bus/Event Hubs/some other resource type? |
Beta Was this translation helpful? Give feedback.
-
@eerhardt @captainsafia I'm trying to consume different services not just storage. For example Service Bus, database etc. |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
Describe the bug
Hi I use Aspire and find it to be a super tool. I've only encountered one problem. Unfortunately there is no option to add Azure Function in Aspire. I have made the following extension method that triggers the Azure Function.
It works pretty well, but I have to manually run the debug no big deal. However, there is one slightly incomprehensible problem. I'm using WithReference to pass connection strings to the Azure Function. However, what happens is that not all connection strings are correct. Sometimes they are taken from Azure Function from local.settings instead of Aspire.
Aspire connection strings:
Function connection strings:
When you start Aspire and debug the Azure function application, the strangest situation occurs. Once a variable is set by local.settings. Once none or once all. Debug breakpoint is inside scope.
I have attached the repository where an example is given.
https://github.com/petrkasnal/ExampleOfAzureFunction
Thanks
Expected Behavior
I expect loaded all environemntes settings from Aspire.
Steps To Reproduce
Exceptions (if any)
No response
.NET Version info
.NET 8.0 dontet-isolated
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions