Introduction to WebJobs in Azure website and Deployment using Portal and Powershell
Web Jobs in Azure websites are exclusive applications or writings running in the contextual of the Azure website as a background task. Below we have listed the files supported by Web Jobs as runnable tasks
- .cmd, .exe, .bat (using a Windows command prompt)
- .ps1 (using Windows PowerShell)
- .sh (Bash)
- .py (Python)
- .js (Node)
You can configure a Web Job as consistently functioning, scheduled task and on-demand basis.
Deploying an Azure WebJob using the management portal
By zipping and deploying application or writing as a .zip file with a maximum file size of 100 MBs, you can deploy a Web Job using the management portal. If you are deploying Web Job either on consistently running task or on-demand, all you have to do is specify the name of the Web Job as well as the path to the zip file. On the other hand, if you intend to deploy Web Job as a scheduled task, you will be given with a choice of configuring it as a one-time task or or Continuously Running or repetitive job. In case of a periodic job, you are allowed to set the granularity of the plan to be as small as few minutes and as large as months. Figure 1 illustrates a job that can be configured to operate after every half an hour.
FIGURE 1 Define a WebJob to run every 30 minutes
Deploying an Azure WebJob using Azure PowerShell
For deploying a Web Job by using Azure PowerShell, you need to use the New-AzureWebsiteJob cmdlet as demonstrated below:
$wjPath = "E:\Contoso-WebJob.exe" $wjName = "Contoso-WebJob" New-AzureWebsiteJob -Name $wsName -JobName $wjName -JobType Triggered -Slot $wsStaging -JobFile $wjPath
The New-AzureWebsiteJob cmdlet is capable of supporting two types of jobs including triggered and continuous jobs. The triggered jobs are similar to the on-demand tasks. Though the JobType limitations can’t assist scheduled Web Jobs.
This article is a part of 70-533 Implementing Microsoft Azure Infrastructure Solutions Prep course.
More Articles included in this course are
Practice Tests in this course are