zyrconium Thank you for posting your question in Microsoft Q&A. Sorry for the delay in response. I assume, you are looking to know how to set up connection string when deploying .NET 7 Isolated Function in Azure and your code snippet follows .NET sample available in GitHub https://github.com/Azure/azure-functions-dotnet-worker/tree/main/samples/EntityFramework.
The settings defined in local.settings.json
are not migrated automatically and as described in this doc, you would need to define these in Connection strings in your Azure Function App. Check Configure connection strings to define App settings and Connection strings and both can be read as environment variables with the same code snippet like you shared.
From your note above, you have already defined connection string in the Configuration section. If so, then I would request to validate the format in accessing the environment variable since connection strings require specific formatting as described below (Use Environment.GetEnvironmentVariable("SQLCONNSTR_EMS")
for your example reference):
Instead of defining connection strings, you can also use app settings to avoid special formatting as described in the docs. I hope this helps with your question and feel free to add a comment for any questions or face any issues. Would be happy to answer any.
Please accept as "Yes" if the answer is helpful so that it can help others in the community.