How to change function app trigger type after creation?

Amit Maharjan 41 Reputation points
2021-06-15T14:23:34.297+00:00

So, I have a function app with http trigger, with the following settings

function.json

{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
}

Now, I want to change the trigger type to queue, I update the settings as such:

{
"type": "queueTrigger",
"direction": "in",
"name": "queueItem",
"queueName": "adreporterqueue",
"connection":"QueueConnectionString"
}

I published the function. But the trigger type is still http. How to change it to queue?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andriy Bilous 11,821 Reputation points MVP Volunteer Moderator
    2021-06-15T14:36:33.687+00:00

    Hello @Amit Maharjan

    Changing of function app trigger type after creation is not supported
    There is a workaround - Define multiple function triggers within one function project and bound them to different targets. Trigger type control can be managed via the App Service Application Settings.
    Example:

    public static class Functions  
    {  
        [FunctionName("FunctionTimer")]  
        public static async Task RunAsync([TimerTrigger("%Schedule%")]TimerInfo myTimer, ILogger log)  
        {  
            if (!AppSettings.IsTimerTriggerActive)   
                return;  
            ...  
        }  
      
        [FunctionName("FunctionEventHub")]  
        public static async Task RunAsync([EventHubTrigger("", Connection = "eventHubConnectionString")] EventData[] eventDataBatch, ILogger log)  
        {  
            if (!AppSettings.IsEventHubTriggerActive)   
                return;  
            ...  
        }  
    }  
    

    https://stackoverflow.com/questions/50939889/is-there-a-way-to-change-the-azure-function-trigger-type-programmatically


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.