0

I have a network location where every hour a csv file gets dumped. I need to copy that file to an azure blob. How do I know that a file has been uploaded to that network drive. Is there something like a file watcher in azure which monitors this network location? Also, is it possible to copy a file from network location to an azure blob through code?

I'm using .net core APIs deployed to an Azure App Service.

Please suggest a possible solution.

Rahul Dev
  • 141
  • 2
  • 17
  • Could you please tell me is that network drive is Azure service like Azure file or not? If its Azure service, we could use Azure app services web job or Azure function service to monitors the network location. – Brando Zhang Aug 24 '20 at 08:37
  • Nope. Its an on-premise share drive location. Its like "\\network\sharedfolders\csvfiles" – Rahul Dev Aug 24 '20 at 11:23
  • As far as I know, if your application has deployed to the azure web app that means you could access the share drive location by using application which hosted on the Azure. Besides, there is no Azure service could monitor a network share. – Brando Zhang Aug 24 '20 at 12:01

2 Answers2

0

You can use Azure Event Grid but as of today Event Grid does not support Azure File Share.

As your fileshare in on-prem the only way I see is that you can write a custom publisher which can run on-prem and uses Azure Event Grid to send the event to Azure Event Grid and a subscriber which can be Azure Function does the work you want it to do.

https://learn.microsoft.com/en-us/azure/event-grid/custom-event-quickstart-portal

But it will only be an Event and not the file itself which has been added\changed and to do that you will have to then upload the file itself into Azure for processing as well. As the above way requires you to do two things I would recommend run a custom code on-prem which runs CRON job like and looks for the new or edited file and then uploads to Azure BLOB Storage and then execute Azure Function to do your processing task.

Hassan Raza
  • 412
  • 2
  • 6
0

Since the files are on-prem you can use powershell to monitor a folder for new files. Then fire an event to upload the file to an Azure blob.

There is a video showing how to do this here: https://www.youtube.com/watch?v=Usih7UywZYA

The changes you need to make are:

Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252