Create an Azure function
Using .NET interop in the Business Central SaaS version isn't possible. By using Azure Functions, you have a possible solution if you still need to connect to .NET libraries. You can directly develop in C# by using the Azure portal code editor, but you can also develop your own .NET DLL libraries and use them within your Azure Function app.
Important
The C# script (.csx) functions that you edit in the Azure portal run in the host process by using the in-process model. Support for the in-process model ends on November 10, 2026. For production apps, develop your C# functions locally as a compiled C# class library project that uses the isolated worker model and reference your own libraries as project references or NuGet packages.
The following code example shows a small .NET Class Library being created. In the Class Library, you can find one class, BlackAndWhiteConverter, which will apply grayscale on an image. The image will be passed as a parameter by using HttpRequestMessage. Therefore, an external library ImageProcessor is used. This library builds on System.Drawing, which is supported on Windows only. If you host your function on Linux, use a cross-platform imaging library such as SkiaSharp or ImageSharp instead.
The following sample also shows the C# implementation.
using ImageProcessor;
using ImageProcessor.Imaging.Filters.Photo;
using System.IO;
using System.Net.Http;
namespace BlackAndWhitePicture
{
public class BlackAndWhiteConverter
{
public HttpResponseMessage Convert(HttpRequestMessage request)
{
var stream = request.Content.ReadAsStreamAsync().Result;
byte[] outArray;
using (var outStream = new MemoryStream())
{
using (var imageFactory = new ImageFactory())
{
imageFactory.Load(stream)
.Filter(MatrixFilters.GreyScale)
.Save(outStream);
}
outArray = outStream.ToArray();
}
var result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new ByteArrayContent(outArray);
result.Content.Headers.ContentType =
new MediaTypeHeaderValue("image/jpg");
return result;
}
}
}
The result of a .NET Class Library is a .DLL file that you can upload to Azure and use in an Azure function. To upload a .NET library, you can open the Advanced Tools (Kudu) console from the function app in the Azure portal, or go to (https://<yourfunctionapp>.scm.azurewebsites.net), and then put .scm before the azurewebsites.net domain name. After you have signed in, you can open a command prompt under the Debug Console menu, where you can browse your app folder and create a subfolder called bin. You can drag and drop your .NET DLL files to this bin folder. A bin folder in the root folder (wwwroot) of the function app shares the assemblies with all functions in the app, and a bin folder in the folder of a function keeps them private to that function.

When the .NET files are uploaded, you can use them in your Azure function. Therefore, you need to use the special #r syntax. This syntax is used to reference external assemblies. Custom assemblies are referenced by their file name. In the following example, the Azure function uses the .NET Library from the previous example.
#r "BlackAndWhitePicture.dll"
#r "ImageProcessor.dll"
using System.Net;
using System.Net.Http.Headers;
using System.Drawing;
using BlackAndWhitePicture;
using Microsoft.Extensions.Logging;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, ILogger log)
{
var converter = new BlackAndWhiteConverter();
return converter.Convert(req);
}