While the documentation for Azure Functions v1 seems to be pretty solid, there's not much documented for v2 and most of the v1 docs are not valid for v2.

The solution is actually straight forward: All you have to do is add a webjob startup class (a class implementing IWebJobsStartup) and register it ([assembly: WebJobsStartup(typeof(Startup))]).

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Hosting;
using UrlShortener;

[assembly: WebJobsStartup(typeof(Startup))]

namespace UrlShortener {

    public class Startup : IWebJobsStartup {

        public void Configure(IWebJobsBuilder builder) {

        }

    }

}

Although this solution is not officially documented, according to this comment on GitHub it seems to be the way to go.