Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

with azure webjobs how do i pass parameter for a scheduled task

I am creating a dot net console app that will run as an Azure webjob. It is scheduled to run once an hour.

I am wondering how I pass a parameter to the job when it is invoked?

like image 767
yamspog Avatar asked Apr 08 '15 22:04

yamspog


People also ask

What is the difference between Azure functions and WebJobs?

Summary. Azure Functions offers more developer productivity than Azure App Service WebJobs does. It also offers more options for programming languages, development environments, Azure service integration, and pricing. For most scenarios, it's the best choice.

What is the use of WebJobs in Azure?

Scheduled – We can execute a Scheduled WebJob by writing a CRON Expression. CRON Expressions define the schedule on which we need the WebJob to run. Manual – We can of course trigger a WebJob manually by calling the webhook. Several Azure services can communicate with the WebJobs using the webhook triggers.

How do I add settings to job file?

Go to https://yourappservicename.scm.azurewebsites.net, then click Debug -> CMD or Powershell (go with Powershell), then navigate to site\wwroot\App_Data\jobs\{continuous/triggered}\job-name\ . Type touch settings. job to make the file. Then click the pencil icon to edit it right in Kudu.


1 Answers

Scheduled WebJobs are actually 2 separate resources:

  1. Triggered WebJob
  2. Azure Scheduler Job

To pass parameters to the WebJob you need to go to the scheduled job (in the management portal) and update the url that is used to invoke the triggered WebJob.

The REST API is described here: https://github.com/projectkudu/kudu/wiki/WebJobs-API#invoke-a-triggered-job

Basically you just need to add ?arguments={your arguments} to the end of the url.

These arguments are passed as command line arguments to your executable.

like image 125
Amit Apple Avatar answered Sep 19 '22 12:09

Amit Apple