如何动态地通过Kudu Api手动运行部署在门户上的azure功能? [英] How to run azure function deployed on portal manually via Kudu Api dynamically?

查看:71
本文介绍了如何动态地通过Kudu Api手动运行部署在门户上的azure功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在门户上部署了时间触发天蓝色功能.它每天上午10:00运行.但是,现在有一个要求,即也应该动态调用函数并在其他时间运行该函数.

I have a time trigger azure function deployed on portal. It runs daily at 10:00 am. However, there is now a requirement that function should also be invoked and run on some other time dynamically as well.

我知道如何使用提到的答案中的步骤通过Kudu Api在function.json文件中动态设置触发器.

I know how to set the trigger in function.json file dynamically via Kudu Api using the steps in answer mentioned here. So using those steps, I can set the trigger for the next minute and run the function.

但这不是实时的,这似乎是一种解决方法.没有直接通过api调用和手动运行azure函数的直接方法吗?

But this isn't real-time, this seems a workaround. Isn't there any direct way to invoke and manually run azure function directly via apis?

推荐答案

没有直接通过api调用和手动运行azure函数的直接方法吗?

Isn't there any direct way to invoke and manually run azure function directly via apis?

我们可以使用REST API触发已部署的Azure功能.我可以使用 Time Trigger C#Azure函数对它进行测试.

We could trigger the deployed Azure function with REST API. I test it with Time Trigger C# Azure function on my side.

Post  https://{FunctionAppName}.azurewebsites.net/admin/functions/{functionName}

注意:我是从Azure门户跟踪它的,我没有找到任何提及此文件的正式文档,如果您想在产品环境中使用此API,请特别注意这一点.

Note: I trace it from Azure portal, I don't find any official document mentioned this, if you want to use this API in the product environment, please pay more attention to this.

我们需要 x-functions-key 作为标题.我们可以从功能应用程序中获取功能键.

We need x-functions-key as header. And we could get the function key from the function Application.

我们还可以使用承载令牌作为授权,有关如何获得此Rest API的授权,请参阅其他

We also could use bearer token as authorization, about how to get the authorization for this Rest API please refer to another SO thread.

已更新:

添加身体信息.

这篇关于如何动态地通过Kudu Api手动运行部署在门户上的azure功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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