Using ARM template to deploy WebJob

963 views Asked by At

I am currently attempting to deploy a webjob as part of my app service through an ARM template. Does anyone have a sample of doing this through a zip deploy?

I have seen here and the linked question there about creating an arm template for a scheduled job but it was not completely clear on how to do it for continuous webjobs/how one would utilize zip deploy to deploy their files.

I currently have a section like this

{
      "comments": "Defines an Azure Web App.",
      "type": "Microsoft.Web/sites",
      "name": "[parameters('siteName')]",
      "apiVersion": "2015-08-01",
      "location": "[variables('siteLocation')]",
      "kind": "appservice",
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]",
        "ConfigJson",
        "MdsConfigXml",
      ],
      "tags": {
        "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('appServicePlanName'))]": "empty"
      },
      "properties": {
        "sourcePlatform": "Unknown",
        "targetPlatform": "Unknown",
        "serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('appServicePlanResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('appServicePlanName'))]",
        "siteConfig": {
          "phpVersion": "off",
          "scmType": null,
          "netFrameworkVersion": "v4.0",
          "use32BitWorkerProcess": false,
          "webSocketsEnabled": false,
          "alwaysOn": "[parameters('alwaysOn')]",
          "httpLoggingEnabled": true,
          "logsDirectorySizeLimit": 50,
          "appSettings": [
            {
              "name": "APPINSIGHTS_PROFILERFEATURE_VERSION",
              "value": "1.0.0",
              "slotSetting": true
            }
          ]
        }
      },
      "resources": [
        {
          "apiVersion": "2018-02-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
          ],
          "name": "ZipDeploy",
          "properties": {
            "packageUri": "[parameters('deployPackageUrl')]"
          },
          "type": "extensions"
        }
      ]
    }

With the deployPackageURL linked to my zip file, which contains my webjob project. However when checking the app service resource, no webjob has been deployed. Can anyone point out possible errors in my ARM template? Thanks!

1

There are 1 answers

2
Doris Lv On BEST ANSWER

We can not deploy webjobs using ARM template.

If you just want to deploy Web App with a Scheduler Job, here is a sample for Scheduler Job Collection.

Here is the ways you could create WebJobs inside Web App.

  • Using the Azure portal.

  • Copying files directly in their proper location.

  • Deploying .NET Console WebJobs alongside an ASP.NET application

  • Deploying a WebJob using PowerShell ARM Cmdlets