azureazure-functionsazure-app-service-plansazure-function-appazure-function-app-proxy

How to Edit Function-app Code in Azure portal


I published the Function-App to Azure and I am using Timer Trigger to Schedule the Function-app at a particular time I want to change the schedule Time how to Edit the Function-App Code

I tried AppserviceEditor it gives an error

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

Is there any other process to Edit Azure-Function-App in Azure portal Itself


Solution

  • Please follow the below steps to make your Scheduled Expression of your Azure Functions - Timer trigger to be a configurable item so that you can change it easily without code deployment.

    1. Use a Binding Expression to configure the schedule as shown below.
    [FunctionName("Function1")]
    public static void Run([TimerTrigger("**%timer-frequency%**")]TimerInfo myTimer, ILogger log)
    {
        log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
    }
    
    1. Create an Application Settings named timer-frequency in your Azure Functionapp. Each time you want to change the expression, you can change it in the App Setting within the portal without re-deploy the code.

    Note: This technique (Binding Expressions) works eves in Azure Function v2 (and ofcourse in v3).

    That's it. You can view the output which gets executed based on the frequency that you set.

    If you would like to have a detailed step-by-step tutorial, please have a look here at https://praveenkumarsreeram.com/2020/08/06/azure-functions-timer-triggers-configurable-scheduled-expressions/