Azure ARM Templates to deploy WebJobs

Rajaram Kumaraguru picture Rajaram Kumaraguru · Apr 25, 2016 · Viewed 7.5k times · Source

Everyone,

Could anyone please help me on deploying WebJobs using ARM Templates ?

Thanks, Rajaram.

Answer

Thibaut Ranise picture Thibaut Ranise · Apr 27, 2016

A template shared by David Ebbo shows how to deploy Webjobs using Arm Templates.

In this template, a triggered webjob is linked to a website deployed by the same template. A webjob is a part of a jobCollection. This jobCollection is linked to it's parent website using the "dependsOn" node.

{
  "apiVersion": "2014-08-01-preview",
  "name": "[parameters('jobCollectionName')]",
  "type": "Microsoft.Scheduler/jobCollections",
  "dependsOn": [
    "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
  ],
  "location": "[parameters('siteLocation')]",
  "properties": {
    "sku": {
      "name": "standard"
    },
    "quota": {
      "maxJobCount": "10",
      "maxRecurrence": {
        "Frequency": "minute",
        "interval": "1"
      }
    }
  },
  "resources": [
    {
      "apiVersion": "2014-08-01-preview",
      "name": "DavidJob",
      "type": "jobs",
      "dependsOn": [
        "[resourceId('Microsoft.Scheduler/jobCollections', parameters('jobCollectionName'))]"
      ],
      "properties": {
        "startTime": "2015-02-10T00:08:00Z",
        "action": {
          "request": {
            "uri": "[concat(list(resourceId('Microsoft.Web/sites/config', parameters('siteName'), 'publishingcredentials'), '2014-06-01').properties.scmUri, '/api/triggeredjobs/MyScheduledWebJob/run')]",
            "method": "POST"
          },
          "type": "http",
          "retryPolicy": {
            "retryType": "Fixed",
            "retryInterval": "PT1M",
            "retryCount": 2
          }
        },
        "state": "enabled",
        "recurrence": {
          "frequency": "minute",
          "interval": 1
        }
      }
    }
  ]
}

Regards,