How can I deploy multiple copies of an Azure function with different parameters

こ雲淡風輕ζ 提交于 2021-01-04 07:36:51

问题


I am currently running an Azure function to periodically pull data from a REST API and copy the data to a set of files. It works fine but is currently architected to iterate through 100 different parameters. Ideally the loads would be independent. Is there any way of deploying an Azure function multiple times with a different static parameter for each instance?

Thanks


回答1:


One possible solution is to use Application Settings to store your parameters if you want to keep your current architecture.

  • Create ARM template to provision your azure function with parameters in app settings (you can use arrays in ARM templates https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-multiple). So in your case, it will create App1, App2, App3 ... each one will have a static parameter specified by the value in ARM template.
  • Use Powershell to deploy your app to each function app. (Something like this should be fine https://blogs.msdn.microsoft.com/benjaminperkins/2016/10/01/deploy-an-app-service-using-azure-powershell-to-a-deployment-slot/). Or perhaps, I guess you can do the entire thing with Powershell.

If I could change your architecture, I would use Durable Functions in this case, it supports Fan In/Out architecture (https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-cloud-backup). So for each request, it will spawn 100 different functions with different parameters as well.

Let me know if you need anything else.



来源:https://stackoverflow.com/questions/54151745/how-can-i-deploy-multiple-copies-of-an-azure-function-with-different-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!