3

I'm trying to create an Azure function that connects to a container that is not hard-coded, much like my connection.

  public static void Run(
[BlobTrigger("Container-Name/ftp/{name}", Connection = "AzureWebJobsStorage")]Stream blobStream, 
string name, 
IDictionary<string, string> metaData, 
TraceWriter log)

The connection property is able to get the connection value directly from local.settings.json. It does not appear that capability is an option for "container-name", or if so, not with the appended /ftp/{name}.

So, is there a way to set the container name based on settings for an Azure Function Blob Trigger?

1 Answer 1

7

You can define your function like this:

public static void Run(
    [BlobTrigger("%mycontainername%/ftp/{name}", Connection = "AzureWebJobsStorage")]
    Stream blobStream, 
    string name, 
    IDictionary<string, string> metaData, 
    TraceWriter log)

and then define an application setting called mycontainername to contain the actual container name.

Sign up to request clarification or add additional context in comments.

1 Comment

Yep. That worked. I tried this... was so convinced this didnt work, but here on the second pass it seems fine. Maybe I typoed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.