Reputation: 425
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.
Upvotes: 6
Views: 2288
Reputation: 8350
To connect Azure Function with Blob file updates, do the following steps.
Click on the '+' icon from the Functions menu.
Then choose "Azure Blob Storage trigger":
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.
From the list, make sure to choose the exact storage account for which you want to be notified.
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).
Besides the account connection, you also need to provide the container name, which you can find if you check your storage account "Blobs" section.
Now the final look before creating the blob trigger should be:
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.
Moreover, this is it, no additional references (#r
) or using
s 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.
Upvotes: 1