0

I have a BlobTrigger Azure Function which works with SFTP Connection via Webhook Event in Container.

So my problem is when I upload files with SFTP Connection it fires my Azure Function twice. (via SFTP Clients(WinSCP, FileZilla etc.) or even with Windows Powershell directly it fires 2 times with two different IDs. )

But when I upload(without SFTP) directly to Storage Account\Container it fires only once as it must be.

How function monitor looks like when I upload my file via SFTP enter image description here

Logs

enter image description here

My Azure Function enter image description here

Tried to handle this with changing extension values in host.json such as maxConcurrent maxProcessor (1 most of the time..) none of it worked unfortunately. I've checked but there is only one slot, Sessions is not allowed etc.

My webhook event in Storage Account\Container

enter image description here

  • Could you please confirm you're seeing those logs in App Insights Logs or File System Logs? –  Nov 19 '22 at 14:01
  • Also, please check this [similar issue](https://stackoverflow.com/questions/52806089/azure-event-grid-blob-storage-prevent-double-blob-created-events) in SO. –  Nov 19 '22 at 14:08
  • Hi @HariKrishna, yes logs are in App Insights and Function\Monitor. My Azure Functions logs directly – tunahanyollar Nov 21 '22 at 05:47
  • Also checked similar issue, unfortunately Content came same for both, I mean I cannot find distinguish between two requests. @HariKrishna – tunahanyollar Nov 21 '22 at 05:59

1 Answers1

0

I found the issue and hopefully it can help someone else in the future;

When we upload a blob directly from the Azure portal, it would only create a single "PutBlob" event, when you use sftp protocol (no matter what software it is), it would create 2 events (sftpcreate and sftpcommit) right after the sftpconnect event. Azure Blob Storage as Event Grid source - Azure Event Grid | Microsoft Learn.

Based on the official documentation, SFTP uploads will generate 2 events. One SftpCreate for an initial empty blob created when opening the file and one SftpCommit when the file contents are written. If you want to ensure that the Microsoft.Storage.BlobCreated event is triggered only when a Block Blob is completely committed, filter the event for the SftpCommit REST API call.

It meets my expectations