How to go serverless with long running functions

Hi all,

I am looking at getting some PowerShell scripts that run on on-prem servers into Azure as serverless scripts.

Some of them are pretty lengthy, and would run for much longer than the 5 minute limit that Azure Functions have (AFAIK)…

While I could potentially split the scripts into smaller chunks, they will mostly, I suspect, go over 5 minutes.

They largely collect data from our environment, Storage & VMWare stuff, and then write it to Azure Tables and CSVs.


My questions essentially are:

  1. where are there any good resources for taking long running on-prem scripts and going serverless? Most Azure Function articles I can find are more about alerting you to stuff, or posting to twitter (Brandon Olin's article on that is probably the best I've read)
  2. Would Azure Automation be a better choice than Azure Functions.
Google has only led me to articles about smaller scripts/tasks...


Thanks in advance…

If I understand correctly, you are working on an inventory job where it pulls the data from various environments across your organisation. If so I would suggest going with the push method instead of the pull method.

Not sure how you are connecting your cloud environment either by express route or site to site VPN, it is ideally a good approach to collect the stats within the localhost and then push them to any central repository on cloud or on-prem instead of running a single job hours together.

Thanks for your response.

What you’re describing is what we are currently doing, but we were hoping to run it in Azure, with a view to getting rid of the script servers.


Then you can spin up a PowerShell Container Instance (ACI) in Azure and run it on on-demand.

Thank you.

That is actually a pretty good idea. I hadn’t thought about that as an option. I will definitely try looking into that.