2
votes

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

1 Answers

6
votes

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.