0
votes

I have a raspberry pi that sends messages to the Azure IoT hub and stores the messages in a storage account's blob container. The problem is, inside my blob container I have the following folder structure: <name_of_IoT_hub>/01/year/month/day/<random_number>/blobfiles I don't know where is this structure coming from. It seems it's got generated automatically. And the blobs contains my messages which is fine but the folder structure is kind of weird. Is there a way to delete all these unwanted folders? Deleting them won't help because with the next message they just come back.

Anyway I wanted to create a logic app with When a blob is added or modified trigger and selected the right blob container but it never triggers. Why is it like this? An http request for example works. But the blob trigger doesn't.

Greetings, Julian

1
Did you ever find an answer to your question? - Taco_Buffet

1 Answers

0
votes

First, check your storage account and make sure it is a general-purpose storage account not Blob-only storage account. Because

Blob-only storage accounts are supported for blob input and output bindings but not for blob triggers. Blob storage triggers require a general-purpose storage account.

Ref: Azure Blob storage bindings for Azure Functions

I show my settings here as a reference for you to check yours.

My Storage account is general purpose v1. You can check yours at storage account Overview-> Account kind.

My blob container name is "blobcontainer" and my function.json is

{
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "blobcontainer/{name}",
      "connection": "AzureWebJobsDashboard"
    }
  ],
  "disabled": false
}

Here you need check the "AzureWebJobsDashboard" to see if has the right storage account name and key in function application settings like this:

enter image description here

My run.csx is

public static void Run([BlobTrigger("blobcontainer/{name}")] Stream myBlob, string name, TraceWriter log)
{
    log.Info($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
}

Start the function when the blob has file created you will see the following log:

enter image description here

As for the folder structure, it is determined by the storage endpoint created in Azure IoT Hub like this:

enter image description here

In order, they are your IoT Hub name, partition, date and time.