Azure Web Job
Deployment Procedure
- A proper subscription to Microsoft Azure
- An Azure App Service
- An Azure Web Job (Development Procedure)
Let’s say we have a console app ready to deploy in Azure as Web job. To know about details about Azure Web job Development you can check my previous article: How To Create An Azure WebJob For SharePoint Online. Specifically, for SharePoint, if the application is developed with User Authentication, then there is no need to create a client app in the SharePoint Site. But if the application is created with SharePoint App authentication (client id and client secret), then we need to create a client app and provide proper permission which is already covered in my previous article.
Create an Azure App Service
- Login to your Azure panel through the following link: https://portal.azure.com
- First, select App Services from the left navigation bar, then click on the add button as shown in the photo below.

- After clicking the Add button, the below window will open.
- Click on Web App as shown in the below picture’s position 1. Then the Web App window will open on the right side, where we will find the create button as shown in the picture’s position 2. Click on the Create button.

- The below window “Web App Create” will pop up or open on the right side.

- Provide the App Service name in position 1 which needs to be unique, which means there can’t be any app service with the exact same name.
- Select a Subscription from the drop-down of position 2. This is to use the subscription methods which you already registered for.
- Select an existing Resource Group or create a new one. These resource groups are being created under Subscriptions. And the App Service which we are creating will be under the Resource Group which will make it easy to impose any rules upon a large number of the same App Services.
- Select preferred Operating system -Windows or Linux. As we are working with Windows, have selected Windows here from position 4.
- In position 5, unless you are using Docker, select code as selected here.
- Select the preferred App Service Plane from position 6. This App Service Plan manages the application server location on which region the app will run and the pricing plan.
- Now, in position 7, we have the Application Insights mode. This is Log Analytics which is selected as “Off” by default. But if you need to trace the log, you can make it “On”.
- After completing all the necessary things, click in the “Create” button.
- It will take a few moments to create the App Service and we will open the “Application Service” overview window. And this app service is ready to be deployed on the Azure Web Job.
Deploy the Azure Web Job
- Now open the web job solution in your Visual Studio.

- Select “Solution Configurations” as “Release” and Build the project from solution explorer of Visual Studio as shown in the above picture.
- Now in the “bin\Release” folder, we will get the compiled files. Address of the release folder: “<Solution Folder>\<Project Folder>\bin\Release”.

- Select all the files and zip them.
- Now, again go to the Azure portal and open the app service which we just created.

- Select Application settings as shown in position 1 and insert the “ClientId” and “ClientSecret” here as shown in position 2.
- Provide “ClientId” string in the key portion and provide “b4f974fb-63ff-40d0-b5ba-4d323fcad9bf” in the value. And do the same for the client secret. Then, Save.

- Now select WebJobs from left navigation as shown in position 1 and click Add at position 2. A new window will open on the right side of the screen.

- Provide the web-job name in position 1 as we have provided “TestWebJob”.
- In position 2, upload the zip file which we have built on step 4.
- In position 3, we need to provide the running method of this web job. There are two types of running method – “Continuous” and “Triggered”. Continuous web job starts immediately when the WebJob is created and runs on all instances that the web app runs on. Triggered web job starts only when it gets triggered manually or on a schedule and it runs on a single instance that Azure selects for load balancing. So, for this article, I have selected Triggered.
- In position 4, we need to select the “Triggers” option – Scheduled or Manual. For Manual, the web job has to be triggered manually or by an API. And for Triggered option, there will be a schedule of which web job will run. So here we have selected the Scheduled option and as a result, the “CRON Expression” field will be visible.
- So, in this potion 6, we need to provide the CORN expression to declare the schedule. This CRON expression is composed of the following six fields -> {second} {minute} {hour} {day} {month} {day of the week}. As we wanted to schedule the web job for 9 a.m., we have written the CRON expression as follows: "schedule": "0 0 9 * * *". For more examples and details about the CRON expression, the following Microsoft documentation, “CRON Expression” has good enough information.
- Now, click the OK button in position 6 which will deploy the web job.

- After successful deployment, the web job will show on the panel as shown in the above image with details.
- So, we can run the web job manually to test that there is no run time issue/error from potion 1.
- After the web job got completed we can check the log from position 2.

- Clicking the “Logs” button in Position 2 will open a new tab as shown in the above.
- We have the log “Web job ran successfully” which indicates the Web job ran without getting any error.

Sahriar SharifPosted Apr 15, 2023, 6:29 AM
Nice Article................. (Y)
Bharat Bhushan KvPosted Apr 22, 2020, 1:09 PM
I have a PnP + CSOM PS script for regular Movement of SharePoint Library docuemnts,folders,sub folders etc. Weekly but want to automate using Azure Web Jobs/Functions. Which could be the best solution ? If you have it want to know a high level major points on it.