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.
In the Azure portal, browse to your function app. Under Settings, choose Configuration. In the Function runtime settings tab, locate the Runtime version. Note the specific runtime version.
Sign in to the Azure portal, then search for and select Function App. Select the function you want to verify. In the left navigation under Functions, select App keys.
Navigate to your function app in the Azure portal, select App Keys, and then the _master key. In the Edit key section, copy the key value to your clipboard, and then select OK. After copying the _master key, select Code + Test, and then select Logs.
From the Monitoring section of your function app in the Azure portal, select Diagnostic settings, and then select Add diagnostic setting. In the Diagnostics settings page, under Category details and log, choose FunctionAppLogs. The FunctionAppLogs table contains the desired logs.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With