Vaishnavi Thanks for posting this question in Microsoft Q&A. Based on the statement above, I assume you are running Azure Function locally, which uses Azure Function Core Tools. Currently, there is no support for .env
file in Azure Function Core Tools which means it never tries to process the file at all. Hence. only local.settings.json
is supported (refer #1129).
In other python projects, there might be a package or library (like python-dotenv library which has load_dotenv()) that can be used code to import .env file. That's not case in Function Core Tools and feel free to check the source code in GitHub https://github.com/Azure/azure-functions-core-tools
To add more context, for example, it loads local.settings.json
https://github.com/Azure/azure-functions-core-tools/blob/v4.x/src/Azure.Functions.Cli/StaticResources/StaticResources.cs#L66 and used it other places.
I hope this helps with your question and feel free to add a comment if you have any other questions. Would be happy to answer.
If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience.