Help me decide which Azure service to use (web api, web job, azure function)?

Kiril 21 Reputation points
2022-03-08T17:31:23.817+00:00

I need to allow users to upload data from an Excel sheet to a Dataverse environment, and to perform a few calculations on the data. My approach is to build an Excel add-in which POSTs the data from the Excel sheet to an Azure service, and then the data is inserted to the Dataverse environment, and then the calculation is handled in the cloud. I am however not sure what service to chose from. I thought about using Functions, but the code for the calculations is rather long (multiple classes, connecting to Dataverse) - would that work? Or would a web api be more suitable for this to work? Are there any other options I should evaluate?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,299 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,188 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,909 questions
0 comments No comments
{count} votes

Accepted answer
  1. MughundhanRaveendran-MSFT 12,431 Reputation points
    2022-03-09T10:54:58.81+00:00

    @Kiril ,

    Thanks for reaching out to Q&A.

    Azure functions would suit your requirement and to be specific, durable functions would be the right choice as they are long running and stateful functions. There is no time out issue with durable function as it would return a 202 response (Accepted) to the Excel addin as soon as it receives a request and continue the execution. There are various patterns available in durable functions, I would suggest you to explore them.

    Durable functions : https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview?tabs=csharp

    Functions can be used irrespective of any Excel addin. For a .net based COM/VSTO addin or Javscript web addin, you can use http triggered azure function if you prefer sending a http POST request to the function. Functions support .net, Javascript languages etc so that you can prefer your comfortable programming stack.

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.

5 additional answers

Sort by: Most helpful
  1. Sudipta Chakraborty - MSFT 1,096 Reputation points Microsoft Employee
    2022-03-08T17:59:19.54+00:00

    You can achieve you requirement by using either of the 2 services i.e. Function App, Web API hosted on API App or Web App with App Service Environment.

    You can have a look at the following table that speaks about few of the features supported and take a decision accordingly.

    181115-difference.png

    2 people found this answer helpful.
    0 comments No comments

  2. Bruce (SqlWork.com) 56,766 Reputation points
    2022-03-08T18:03:44.357+00:00

    does the user need to wait for completion? if not, then maybe a webjob.

    azure functions are generally cheaper than a hosted webapi. max runtime is 10 minutes. but if it takes this long, you should use a web job.

    1 person found this answer helpful.

  3. Bruno Lucas 4,411 Reputation points MVP
    2022-03-09T00:47:58.02+00:00

    Azure functions is cheaper and a little bit less flexible.

    If you are more comfortable writing C# web api's with mvc , you can deploy to the azure web api. If you go with Azure Functions, you need to use the Azure Function approach: https://www.c-sharpcorner.com/article/creating-a-rest-api-with-azure-functions/

    Azure functions are now a little more flexible. you can even do it with dependency injection. that may be beneficial for longer complex code.

    1 person found this answer helpful.
    0 comments No comments

  4. sadomovalex 3,626 Reputation points
    2022-03-09T16:02:14.977+00:00

    http-triggered Azure functions may be used but note this: Function app timeout duration

    Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle timeout of Azure Load Balancer. For longer processing times, consider using the Durable Functions async pattern or defer the actual work and return an immediate response.

    i.e. if you expect it to run more than 230 seconds then consider another approach. Durable functions were already mentioned but you may also consider queue-triggered Azure functions. In this case you will need to put a message to the queue with necessary data and then it will be automatically processed by queue-triggered Azure function. The advantage of this approach that it is scalable - there may be up to 24 functions running in parallel (see https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=in-process%2Cextensionv5&pivots=programming-language-csharp#concurrency).

    1 person found this answer helpful.
    0 comments No comments