有没有一种方法可以触发"http触发器"?天蓝色功能,部署ARM模板后? [英] Is there a way trigger "http trigger" azure function, after deploy ARM template?

查看:55
本文介绍了有没有一种方法可以触发"http触发器"?天蓝色功能,部署ARM模板后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有部署kubernetes集群和httptrigger函数应用程序的ARM.在httptrigger func内部,我有kubernetes的客户端,如果我手动触发此func,它会执行一些操作,它的工作正常.但是我需要在完成ARM部署后自动运行此触发器.

I have ARM who deploy kubernetes cluster and httptrigger function app. Inside httptrigger func I have client for kubernetes who do some action if I trigger this func manually, its work fine. But I need run this trigger automatically after deploy ARM was finished.

推荐答案

可以通过ARM本身,Azure DevOps管道或用于执行模板的任何协调器来发送触发Azure功能的HTTP请求.Terraform可以直接执行脚本;除非您真的想使用ARM,否则可能是一个选择.

The HTTP request that triggers the Azure Function may be sent either by ARM itself, or by the Azure DevOps pipeline or whatever orchestrator you use to execute the template. Terraform can execute scripts directly; unless you really want to use ARM, it might be an option.

如果要使用ARM,则至少有三个选择:

If you want to go with ARM, there are at least three options:

  1. 使Azure函数返回空" ARM模板,并通过请求嵌套部署模板来触发它. https://blog.cloudtrooper.net/2017/04/04/run-azure-functions-from-your-quickstart-arm-templates/
  2. 使用 Azure容器实例在Azure的独立容器中启动容器映像的实例,并在其中执行任意命令. https://samcogan.com/run-scripts-in-arm-deployments-with-aci/
  3. 使用部署脚本资源(Microsoft.Resources/deploymentScripts).它基本上是对使用Azure容器实例的方法的内置支持.目前处于预览阶段,API版本为2019-10-01-preview. https://dev.到/omiossec/arm-template-what-s-new-for-2020-4kli#deployementsscripts-resource-provider
  1. Make the Azure Function return an "empty" ARM template and trigger it by a request for nested deployment template. https://blog.cloudtrooper.net/2017/04/04/run-azure-functions-from-your-quickstart-arm-templates/
  2. Use Azure Container Instances to launch an instance of a container image in a stand-alone container in Azure and execute an arbitrary command inside. https://samcogan.com/run-scripts-in-arm-deployments-with-aci/
  3. Use the deployment scripts resource (Microsoft.Resources/deploymentScripts). It is basically a built-in support for the approach using Azure Container Instances. It's in preview, currently, API version 2019-10-01-preview. https://dev.to/omiossec/arm-template-what-s-new-for-2020-4kli#deployementsscripts-resource-provider

在任何情况下,您都需要通过属性设置dependsOn引用,以便在正确的时间发送请求.

In any case, you will need to property set up the dependsOn references so that the request is sent at the right time.

这篇关于有没有一种方法可以触发"http触发器"?天蓝色功能,部署ARM模板后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆