Azure Webjob SDK 3.x with .NET Framework

Ever wondered whether Azure Webjob SDK 3.x also works with .NET Framework apps?
Documentation is focusing on .NET Core and there is some confusion about this on github https://lnkd.in/dwGD-cf.
I just tried it out and found it to work without problems with this Main-method in Program.cs:

static void Main(string[] args)
{
	var builder = new HostBuilder();
	builder.ConfigureWebJobs(b =>
	{
		b.AddAzureStorageCoreServices();
		b.AddAzureStorage();
	});
	builder.ConfigureLogging((context, b) =>
	{
		b.AddConsole();
	});
	var host = builder.Build();
	using (host)
	{
		host.Run();
	}
}

Application Insights is also working by simply adding the Nuget package and setting up the instrumentation key in ApplicationInsights.config.
Be aware that description of the storage config in https://lnkd.in/dYSTymh is not complete (also see https://github.com/Azure/azure-functions-core-tools/issues/89) – you need a “ConnectionStrings”-setting in appsettings.json like this:

"ConnectionStrings": {
      "AzureWebJobsStorage": {your storage connection string}
}

Have fun.

Leave a Reply

Your email address will not be published. Required fields are marked *