Azure Function App = run single Azure Function locally to debug
As @Pawel Maga mentioned there are three ways.
I have a little better approach for 3rd option (Specify functions in the host.json file).
Instead of messing with host.json (we might forget to undo while publishing.. i have done it many times :p).
We can override functions array by setting value in local.settings.json.
For example: Set like below code in local.settings.json
{
"Values": {
"AzureFunctionsJobHost__functions__0": "FunctionToRun",
"AzureFunctionsJobHost__functions__1": "SecondFunctionToRun",
}
}
Instead of writing below code in host.json
{
"functions":[ "FunctionToRun", "SecondFunctionToRun" ]
}
There is no easy way to achieve this, but it is possible.
- Disable functions:
by modifying the function.json file:
"bindings": [
...
],
"disabled": true
or by using the [Disable] attribute:
[Disable]
[FunctionName("Function")]
[NoAutomaticTrigger]
public static void Function(string input, TraceWriter log)
{ }
- func run using Azure Core Tools (only v1.x)
Run function using command: func run <functionName>
- Specify functions in the host.json file
In your host.json file specify functions that should be run:
{
"functions":[ "FunctionToRun" ]
}