Hi ,
Thanks for reaching out to Microsoft Q&A.
Yes, you are running into a known limitation in azure functions.
In the @blob_trigger, the path parameter does not support env variable substitution, unlike the connection parameter which does. That is why the connection string is working fine from your environment variable, but path="PG_DUMP_CONTAINER_NAME" is not being resolved.
Why?
-
connectionis handled as a configuration setting and resolved by the azure functions runtime. -
pathis treated as a literal string at the time the function bindings are processed. There is no interpolation from environment variables or app settings in thepathparameter.
Workaround
Unfortunately, you must hardcode the container and blob path in the path parameter like this:
@app.blob_trigger(arg_name="client",
path="my-container-name/{name}",
connection="PG_DUMP_CONTAINER_CONNECTION_STRING")
If you really need to make it dynamic:
Hack (not recommended for prod loads)!
You could try:
Generating the function code dynamically using Python before startup.
Or using a generic Event Grid trigger to listen to blob events, and handle paths in code.
Example using Event Grid trigger:
@app.function_name(name="BlobEventGridTrigger")
@app.event_grid_trigger(arg_name="event")
def blob_event_handler(event: func.EventGridEvent):
blob_url = event.get_json()["data"]["url"]
# Use blob_url to dynamically process the blob
-
pathdoes not support env vars, limitation of Azure Functions. -
connectiondoes support env vars. - You must hardcode the path or switch to using Event Grid triggers for dynamic scenarios.
Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.

