1

I have several scripts on the "azure virtual machine" that run once a day at a certain time, extract data from several web services and push the extracted data into the "azure database for postgresql server".

I want these scripts to run from the 'azure function app' instead of the 'azure VM'.

At the moment I have a folder with all these scripts in a blob container.

Issues:

  1. Is it possible to run these scripts from the blob container? or is it easier to download these scripts and run them through the made function? or other ideas?

  2. What trigger should I use in the function? I need to run these scripts every day (looks like a timer trigger); these scripts get data from web services (looks like an http trigger). But It's possible to use one trigger for one function doc. Moreover, timer trigger doesn't have input/output doc.

  3. Do I understand correctly that in my case, the data I retrieve from web services should be the "input data" for my azure function, and when I put it into the postgresql database, it should be the "output data" for the same azure function?

I'm new at Azure and try to understand all the logic behind function apps. So, any help is welcome!

CapJS
  • 75
  • 7

1 Answers1

1

Considering these scripts need to be run at specific time of the day, you would want to use Timer Trigger Azure Functions. That would ensure that your Function invokes on a scheduled time.

Since the scripts are stored in blob storage, first thing you would do in your Function code is to download these scripts locally from blob storage. You can use any available Blob Storage SDK to do that. For example, here's the link to use Blob Storage SDK for Python: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python.

Once the scripts are downloaded locally, you should be able to execute these scripts.

Please do keep in mind that each Azure Function can only run for a maximum of certain amount of time (i.e. it cannot run indefinitely) so you may want to ensure that your script execution is complete within that time.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241