The code itself looks correct to me. If that’s returning None it could be due to your Python version. Azure's flex consumption plan does not fully support Python 3.13 yet.
Can you confirm what Python version your Function App is set to in Configuration → General settings? At the moment, Azure Functions officially supports Python 3.10, 3.11, and 3.12. If the app is configured to use 3.13, the runtime will not load any environment variables.