I have an Azure Functions project in Visual Studio holding two functions - HttpTriggerFunction1 and TimerTriggerFunction1.
I want to publish Azure Function project from Visual Studio to different Azure Functions Apps - HttpFunctionApp and TimerFunctionApp which I created at Azure.
Is there an option from Visual Studio to achieve above deployment strategy (probably customize publish profile?)? Or do I need to use Release definition of VSTS to have the appropriate functions to be published to appropriate function app, in such a case, how to achieve this because my DLL might have code related to other functions (Run methods) which should not be making to all function apps?
I am using VS 2017 15.8.2 with latest Azure Webjobs and Tools.
The usual way to do this would be to split the code into separate projects - a Functions project containing HttpTriggerFunction1
, a Functions project containing TimerTriggerFunction1
and a library project for shared code if there is any. You can then deploy each Functions project to its own Function App.
If for some odd reason that's not feasible, you could instead create separate configurations each of which has a post-build step that removes the function.json
file for the functions you don't want to be available. For example, the configuration for deploying to HttpFunctionApp
would remove TimerTriggerFunction1/function.json
. Although the DLL will still contain the Run methods, the Azure Functions runtime won't treat them as functions if the function.json
file isn't there.