I have tried many things but the only way I can force AzFn to understand the invocation has failed, is to throw an exception and not handle it. So, if I return an HttpResponseException, AzFn will consider the invocation as a success. That feels wrong.
catch (Exception ex)
{
logger.Error($"{nameof(ex)}: {ex.Message}", ex);
response = req.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message, ex);
}
This should produce an invocation marked as fail but it doesn't.