I have a console application connecting to database and executing DML transactions. This console application is currently scheduled using windows task scheduler. I am planning to migrate this to Azure.
Which is the recommended strategy ?
Should this be moved as Azure webjobs or function apps ?
Since you already have a console project, then it's more easier to use Azure Webjobs to achieve that.
To create a webjob, just create a .zip file which includes the .exe / .dll and other necessary files, then upload to azure. For schedule, please refer to Create a scheduled WebJob. For more details, you can refer to this doc.
Note: there're some limitation of azure webjobs / azure function, see Azure-Web-App-sandbox. But if you only need to connecting to database and executing DML transactions, you can ignore the limits.
And yes, you can also do this via azure function, but since you already have a console project, it's easier to use webjobs.
Related
I want to create a web app with node.js where users can schedule tasks that are executed on a specific time entered by the user.
I was thinking to use azure-webjobs or azure-functions for executing said tasks. I understand that scheduling in the azure portal is possible, however I couldn't find an API to schedule a webjob or function programmatically (for example using the Azure REST API).
Is it possible to schedule a azure-webjob or azure-function programmatically?
Azure WebJobs provide a more or less hidden API inside of KUDU called WebJobs API. This API is REST based webservice and it can be used to manage your jobs programmatically.
There are API endpoints available for the Azure WebJob which will be used for triggering the WebJob.
See the following documentation link for details on the list of available endpoints: https://github.com/projectkudu/kudu/wiki/WebJobs-API
Check this article: How to manage Azure WebJobs programmatically?
Also see this article might be helpful.
My app needs a background service that constantly receives and handles events streamed from an Azure Event Hub.
I see that Azure Functions has built-in triggers for this, but the problem is that my app is written in .NET 5 and Azure Function support for it is fairly immature at this point.
I also see from this documentation that .NET has an readily-made SDK Azure.Messaging.EventHubs. My understanding is that this will run as a console app.
I'm already using the Azure App Service (Linux plan) to host the main web app.
So if I create a console app using Azure.Messaging.EventHubs, I'd want to deploy it as something like a web job, but the Linux app service plan doesn't support it. I guess I can deploy the console app it to a separate Windows App Service plan.
What's the next best option? Are there any practical differences compared to using Azure Functions?
There's also this .NET Core Worker Service that's more optimized for background services. I wonder if there's a place for it in this use case.
These options are confusing me a bit. Your advices would be greatly appreciated.
Azure function should be the best choice. It has the built-in eventhub trigger and process logic, and easy to setup / configure(like logging via Application Insights) / less code to write. And recently(Mar 10 2021), it is supported for running production .NET 5 apps on Azure Functions. I suggest you can give it a try and use it if no issues.
For azure webjobs, in this case, if you're directly using the SDK, you need to write many codes and configure something like logging.
For .NET Core Worker Service, it can also be published as azure webjobs if you want to use it. You can follow this doc on how to publish worker service as azure webjob.
I want to be able to run an exe file in an on premises server from Azure, using a Logic app or maybe azure scheduler.
Is this possible, if so how?
Even doing this via Azure function could be an option. Do i need something like on premises data gateway or maybe even hybrid connections?
As I known, Azure Scheduler and Logic App don't support .exe file.
For Cloud service, I think you can use worker role to meet your requirement. Worker role could handle background processor. Also, you can use the startup task to run your exe.
You can see a example in this document.
We have one windows application installed in Azure VM. We want to execute that application using Azure so that we will be able to monitor execution of this application using Azure portal.
Is there any way to invoke an executable present in one Azure VM using Azure Data Factory pipeline or some other service present in Azure?
What does the exe do? Is it a console app?
Generally, I think it's possible.
This can be achieved by using ADF Custom Activity. You may rewrite your app as a custom activity, which will be run in Azure Batch VMs.
If your app can't be run in Azure Batch, you will have to enable something like PowerShell remoting, so that exe can be launched remotely. Caveat is, even in this case, you will still need a Custom Activity / Azure Batch as invoker, since ADF Pipeline itself can't do remote call or run custom code.
Hope this will help.
Azure Web Jobs are a big time saver in that they solve the plumbing of triggers, continuous running, dashboard, etc. But I've only seen them run in Web sites. It'd be great to be able to move them to a Worker Role. Do you have suggestions about how to do it?
I'd personally love to see how they implement it, so that I can replicate it in my worker role, without reinventing the wheel...
The answer to the main question is No Azure WebJobs are part of Azure Websites and only run in an Azure Website context/host.
But Azure WebJobs SDK which is an SDK that allows you to write code that is triggered on Azure storage blobs/queues and Azure service bus queues including some great logging capabilities, can be used outside of Azure WebJobs and so they can run anywhere (locally, VMs, WebRoles).
It is important to understand that Azure WebJobs are a framework that is part of Azure Websites that allows (almost) any console application (and .bat, .php, .js, ... scripts) to run continuously or triggered (manually/scheduled).
WebJobs SDK and WebJobs are not dependent on each other although they work great together.
Also to see how it's implemented go to https://github.com/projectkudu/kudu as it's open sourced (for now The WebJobs part, SDK may be open sourced in the future).
Yes, you can use Azure WebJobs outside of Azure Web Sites. You use the Azure WebJobs SDK to do so. There is a sample on MSDN on how to use the SDK in an console app. It then goes on to host it in a web site, but you can of course host it in other ways. There is another article, "Hosting Azure webjobs outside Azure, with the logging benefits from an Azure hosted webjob" that explicitly talks about using WebJobs outside of Azure. With a little work this should work in a Worker role as well.
I'll stipulate that I've not actually done this myself, but the SDK does make it possible.
I'd also recommend this treasure trove of resources for WebJobs.