如何部署具有不同参数的Azure函数的多个副本 [英] How can I deploy multiple copies of an Azure function with different parameters
问题描述
我当前正在运行Azure函数,以定期从REST API中提取数据并将数据复制到一组文件中.它工作正常,但目前已设计为可迭代100个不同的参数.理想情况下,负载将是独立的.有没有办法为每个实例使用不同的静态参数多次部署Azure功能?
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?
谢谢
推荐答案
一种可能的解决方案是,如果要保留当前的体系结构,则使用应用程序设置
存储参数.
One possible solution is to use Application Settings
to store your parameters if you want to keep your current architecture.
- 创建ARM模板以在应用程序设置中为您的Azure函数提供参数(您可以在ARM模板中使用数组"> https://blogs.msdn.microsoft.com/benjaminperkins/2016/10/01/deploy-an-app-service-using-azure-powershell-to-a-部署插槽/).或者,也许我想您可以使用Powershell来完成整个工作.
- 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.
如果可以更改您的体系结构,在这种情况下,我将使用耐用功能,它支持Fan In/Out体系结构(
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.
这篇关于如何部署具有不同参数的Azure函数的多个副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!