What is the best way to run a console application only a few times per day and what is the best payment plan?

Dário Margaça 21 Reputation points
2022-11-15T13:12:57.55+00:00

Hello,

I wanted to automate a console application to only run a few times a day in azure for a couple of seconds/minutes. I know that these kind of things usually either use functions app or webjobs. Since my console application isn't a single function and has a few helper classes, i guess i can't use function app for that purpose. This been said, i think my only remaining option is webjobs in App Service. Am i right? Or am i missing other possible options?

Being App Service Webjobs the best option to do it so, how can i only pay when the webjob runs? I only need a system/VM to run everytime the webjob will run. Besides that, it can always be turned off in order to avoid additional unnecessary expenses. What could be the best approach in terms of payment plans for this?

Thank you in advance for the help.

Best Regards,
Dário Margaça

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
3,580 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,935 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 60,161 Reputation points
    2022-11-15T16:14:36.697+00:00

    I think an Azure function is the correct approach as it has a trigger for this specific case. I'm not sure what you mean by having a single function as you can any number of classes and they can have any # of methods in an Azure Function. What gets deployed is the class library all that code is contained in so you can have anything in the class library you need. In order for Azure to see the "function" it has to be attributed. But that function can create instances of any types and call their methods like normal. For simple functions it may do it all inside the single function but most likely the "function" is just a wrapper around the class that does the actual work based upon the data it gets.

    Refer to this for more information.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-11-16T07:48:29.97+00:00

    Hi @Dário Margaça ,

    Thanks for reaching out to Q&A forum.

    You can choose between timer trigger function and azure webjobs. The helper classes would work fine with functions and webjobs. It actually depends on the execution time of the console application. If the execution time exceeds 10 minutes, then you can go for webjobs. The default timeout value of the function execution is 10 minutes. This is applicable for functions running on consumption plan. This timeout value can be increased for functions running on dedicated app service plan and premium plan.

    Functions time out : https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#timeout

    Now talking about the pricing, the functions would be the best approach as you will be charged for the number of executions (consumption plan). In webjobs, you will be charged for the App service plan whether the webjobs are being executed or not. Please note that, when you turn off the app service, you willl still be charged as the app service plan is still running. So you can decide between functions and webjobs based on the above inputs.

    App service pricing : https://azure.microsoft.com/en-in/pricing/details/app-service/windows/
    Functions pricing : https://azure.microsoft.com/en-us/pricing/details/functions/

    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.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.