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)
  • .php
  • .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.

WebJobs in Azure website 1

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


Azure Cross-Platform Command-Line Interface

Using the Azure Cross-Platform Command-Line Interface tools for configuration tasks The Azure PowerShell cmdlets can be referenced for automating jobs ...
Read More

Diagnostic logging for Applications and Sites in Azure

Enabling Diagnostic Logging for Applications in Azure Diagnostic logging cannot be supported by default. It’s completely up to you whether ...
Read More

Retrieving diagnostic logs in Azure

Steps for retrieving diagnostic logs in Azure There are a number of choices to retrieve diagnostics logs or simply observing ...
Read More

Streaming Logs in Azure

Viewing streaming logs in Azure This article explains how can you view streaming logs in Azure. Sometimes it is preferable ...
Read More

Azure website resources

Monitoring Azure website resources The management portal provides rich and visually appealing screens to monitor your Azure Website resources included ...
Read More

Practice Tests in this course are

No posts found.