Azure ARM Templates to deploy WebJobs

梦想与她 提交于 2019-12-06 20:35:51

问题


Everyone,

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

Thanks, Rajaram.


回答1:


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,




回答2:


The other answers cover the template aspect of getting the job created in Azure, but there's still the question of getting the webjob executable uploaded.

Assuming this deploy is part of a larger Azure website deploy, you simply need to include your webjob executable in the distribution of your website.

Per the kudu documentation the convention for placing your EXE is as follows:

To deploy a triggered job copy your binaries to: app_data\jobs\triggered\{job name}

To deploy a continuous job copy your binaries to: app_data\jobs\continuous\{job name}




回答3:


Here's an Azure QuickStart Template that deploys an Azure Web App with a Schedule Job.

Additionally, have you looked at the Visual Studio 2015 Azure SDK support for the Azure Resource Manager project type? It contains UI for more easily authoring ARM Templates directly from within Visual Studio.



来源:https://stackoverflow.com/questions/36839631/azure-arm-templates-to-deploy-webjobs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!