Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

Web Jobs is a feature of Azure App Services that run a program or script in the same instance as a web app, API app, or mobile app. There is no additional cost to use Web Jobs.

Azure Enablement comes with the ability to run the existing schedule tasks (configured in Aptify Smart Client) on Azure Portal as a Web Job.

This document is divided in three parts:

The Current scope of the WebJobs is as follows:

  1. Only Once, Daily, Weekly, Monthly, Monthly Relative types of frequency are supported.

  2. Run History Tab on Scheduled Task records will not be updated.

  3. Service should always be “Schedule Web Job Only“ on Scheduled Task record to run the task as WebJob.

  4. The checkbox “Delete the task if it is not scheduled to run again“ is not in scope for now.

  5. The Scale of the job will always be “Single Instance“ and Type “Continuous“ on Azure Portal, more is discussed in the document below:

Part 1: Code File Config Changes

  1. Open the Zipped Folder Containing the code files. <<path and name of the file>>

  2. Search for WebJobManualDeploy.exe.config and open the same in Note Pad or Note Pad ++

  3. The tags “AzureWebJobDashboard“ and “AzureWebJobStorage“ both are to be configured with Storage Account Connection String.

  4. Under the AppSettings tag, value for key=”frequency” will be any one of the following : all, once, daily, weekly, monthly, monthlyRelative. This is for the type of job which is needed to be scheduled on portal. For example , a code with frequency daily will only run the task which are of type daily in database. It is to be noted that this setting is case sensitive.

  5. App Insights has been configured for these web jobs and logs can be found App Insight log file. But to enable the app insights, Instrumentation Key is required (Line 25 of the picture below). Refer to Configuring Serilog with Azure Application Insights.

  6. To get instrumentation key for App Insights, log into Azure portal and select the service Application Insights.

  7. Select the Application Insights for which you want to configure the logs.

  8. Under the overview tab you will find the Instrumentation key.

  9. The below keys are required by web job to log into the database:

    1. UserDatabase = “Aptify”

    2. EntitiesDatabase = “Aptify“

    3. SqlLogin and Password are the credentials to log into the database.

    4. Server = Managed instance Endpoint (See Point 10-12)

  10. To get managed instance endpoint, log into the Azure portal and select Sql Managed Instances Service.

  11. Select the instance to be connected with the web jobs.

  12. Once you select the instance you will find Networking under Security and Endpoint on the right pane of screen as shown in screenshot below.

  13. Once all the changes are done in config file, save and close it. Now Select all the code files and zip them, give the zipped file a meaning full name. After this we are done with the code file changes.

Part 2: Creating/Updating Schedule Task Record in Smart Client

  1. Open Smart Client, Collapse Process Pipeline Application and right click Scheduled Task Service, click “New Scheduled Tasks Records“

  2. Under the new scheduled task record, there are few mandatory settings which are needed to get this task run by Azure WebJobs. These are as follows:

    1. Service: Alway select “Schedule Web Job Only

    2. Web Job Enabled: This checkbox must be selected (Once you select service as Schedule Web Job Only, this will be automatically selected)

    3. Is Enabled: This checkbox should also be selected.

Note: All other functionalities (Start Date, End Date, Repeat Task etc.) on “New Scheduled Tasks Record” remains the same. Also existing Scheduled Tasks can be modified to run by Azure Web Job. To do that, just change the Service to “Schedule Web Job Only“ and make sure the “Web Job Enabled” Checkbox is selected.

Part 3: Deploying the zipped code file on Azure Portal

  1. Open Microsoft Azure Portal, on the home page, click App Services.

  2. Select the App Service in which your web job will run.

  3. After selecting App Service on the newly opened right pane select “WebJobs“ under “Settings

  4. Under WebJobs, click + sign to add a new web job. A new pane Add WebJob opens on the right part of the screen. Under Name, give any meaningful name for the job.

  5. Under File Upload, click upload button and a new window opens. Now select the zipped file created in Part 1.

  6. Set the Scale to Single Instance.

  7. Click OK, it may take few seconds for the job to be visible under the dashboard in Running Status. Now it will start executing the scheduled task as per their schedule.

  • No labels