如何在 Azure 门户中编辑函数应用程序代码

How to Edit Function-app Code in Azure portal

我将 Function-App 发布到 Azure,我正在使用 Timer Trigger 在特定时间安排 Function-app 我想更改时间表时间如何编辑功能应用程序代码

我尝试了 AppserviceEditor 它给出了一个错误

Failed to save 'function.json': Unable to save "/Function1/function.json". Please try again later. Error code: 409

是否有任何其他过程可以编辑 Azure 门户中的 Azure-Function-App

请按照以下步骤将您的 Azure Functions - Timer 触发器的计划表达式设置为可配置项,以便您无需代码部署即可轻松更改它。

  1. 使用绑定表达式配置时间表,如下所示。

    [函数名("函数 1")] public static void 运行([TimerTrigger("%timer-frequency%")]TimerInfo myTimer, ILogger 日志) { log.LogInformation($"C# 定时器触发器函数执行时间:{DateTime.Now}"); }

  2. 在您的 Azure Functionapp 中创建一个名为 timer-frequencyApplication Settings。每次您想更改表达式时,都可以在门户内的“应用程序设置”中进行更改,无需 re-deploy 代码。

注意:此技术(绑定表达式)在 Azure Function v2(当然在 v3)中有效。

就是这样。您可以查看根据您设置的频率执行的输出。

如果您想获得详细的step-by-step教程,请查看https://praveenkumarsreeram.com/2020/08/06/azure-functions-timer-triggers-configurable-scheduled-expressions/