6
votes

I had a working Function App that got a blob input and an event hub output (worked in beta). With latest changes, my function no longer works. I've tried to update the host.json file according to the release note, but it has not reference to blob trigger:

{


"version": "2.0",
  "extensions": {
      "blobTriggers" : {
        "name": "blob",
        "type": "blobTrigger",
        "direction": "in",
        "path": "iot3gblobs/{name}",
        "connection": "AzureWebJobsStorage"
      },

      "eventHubs": {
        "type": "eventHub",
        "name": "outputEventHubMessages",
        "path": "ioteventhub",
        "connection": "IoTEventHubConnection",
        "cardinality": "many",
        "direction": "out"
      }
    },
    "Host" : 
    {
      "LocalHttpPort": 7071,
      "CORS": "*"
    },
  "disabled": false
}

Also, when upgrading Microsoft.NET.Sdk.Functions from 1.0.14 to 1.0.19 the blobTrigger attribute is not recognized and my code will not compile:

[FunctionName("iotserverparser")]
        public async static Task Run(
            [BlobTrigger("iot3gblobs/{name}", Connection = "AzureWebJobsStorage")]
            Stream blob,
            [EventHub(
                "outputEventHubMessages", Connection =
                    "IoTEventHubConnection")]

As mentioned before, this is because of the last Azure Function App update and I have not seen any example of how to work with Blob Trigger in this new 2.0 version.

1
You need to use new packages for the blob storage bindings. Microsoft.Azure.WebJobs.Extensions.Storage @ 3.0.0-beta8 (Check "Prerelease") should make those triggers compile again. In general, this latest Azure Func changes broke alot of stuff: github.com/Azure/Azure-Functions/issues/928Svend
Thanks, @Svend - that did the trick! What a mess...Dani Toker
Yes, a mess is an understatement. I wasted 10 hours this weekend on this (well other breaking changes)Svend

1 Answers

1
votes

To connect Azure Function with Blob file updates, do the following steps.

  1. Click on the '+' icon from the Functions menu.

    enter image description here

  2. Then choose "Azure Blob Storage trigger":

    enter image description here

  3. After a popup/sidebar will open, and you need to fill your blob related information.
    That is quite easy, but first, click on the "new" link and it will popup another view where you can see the list of your storage accounts.

    enter image description here

  4. From the list, make sure to choose the exact storage account for which you want to be notified.

  5. After you shall see the storage name appearing under the "Storage account connection" input box (you may also see some additional label appended at the end of storage name, like "..._STORAGE", that's ok).

  6. Besides the account connection, you also need to provide the container name, which you can find if you check your storage account "Blobs" section.

    enter image description here

  7. Now the final look before creating the blob trigger should be:

    enter image description here

Here make sure you don't touch the {name} part under the Path input. That variable is needed to reflect the changed file/blob name.

  1. Finally, click on the "Create" button and after try to upload any file in your blob container. You should see the logs representing the changes. enter image description here

Moreover, this is it, no additional references (#r) or usings are necessary to see the blob changes.

Note that blob changes might reflect with a bit delay under the Logs section. However, if after some time you still don't see any updates there then check once more that you have provided correct Storage Account and container names. To do that you might need to create the blob trigger again.