
In this Azure article, we will discuss how to create and deploy Azure Webjobs and along with that, we will also discuss a few other topics as mentioned below.
- What is Azure WebJobs?
- How to deploy Azure Webjobs to Azure
- Run the Azure Webjob using Azure Portal
- How to check the logs of the Azure Webjobs
- How to Delete Azure Webjob using Azure Portal
Table of Contents
How to create and deploy Azure Webjobs
Well, before discussing how to create and deploy Azure Webjobs, we will discuss What is Azure WebJobs? and the Prerequisites needed here before starting the actual functionality.
What is Azure WebJobs?
Azure Webjobs is an excellent feature that helps you to run a script or a program as a background process in your web app or mobile app, etc. You can also achieve the same functionality with the help of Azure Function.
Now, let’s discuss the prerequisites needed to start the actual functionality.
Prerequisites
Below are the prerequisites needed for creating and deploying Azure Webjobs.
- You must have an Azure subscription or Azure Account. If you are new to Azure and you don’t have an Azure account as of now, you can create an Azure free account now.
- You must have Visual Studio 2019 or later version installed on your machine. If you have not yet installed, nothing to worry, you can download and install Visual Studio 2019 now.
Assuming, you are ready with all the prerequisites needed here, let’s start the actual development of the Azure Webjobs using Visual Studio 2019.
Creating Azure Webjobs using Visual Studio 2019
Follow the below steps to create an Azure Webjobs using Visual Studio 2019.
- Open Visual Studio 2019 in your development machine.
- Click on the Create a new Project button.
- On the template window, search for Azure webjob and then click on the search result Azure Webjob (.NET Framework) –> Click on the Next button.

4. On the Configure your new project window, provide the below details
- Project name: Provide a valid name for your project.
- Location: Choose a location where you want to save your project.
- Framework: You can choose the latest version.
Finally, click on the Create button to create the project.

Now, you can able to see below that the project got created successfully.

Open the Program.cs file and you can able to see the below lines of code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
namespace TsInfoWebjob
{
// To learn more about Microsoft Azure WebJobs SDK, please see https://go.microsoft.com/fwlink/?LinkID=320976
class Program
{
// Please set the following connection strings in app.config for this WebJob to run:
// AzureWebJobsDashboard and AzureWebJobsStorage
static void Main()
{
var config = new JobHostConfiguration();
if (config.IsDevelopment)
{
config.UseDevelopmentSettings();
}
var host = new JobHost(config);
// The following code ensures that the WebJob will be running continuously
host.RunAndBlock();
}
}
}
Below is the app.config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<!-- The format of the connection string is "DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY" -->
<!-- For local execution, the value can be set either in this config file or through environment variables -->
<add name="AzureWebJobsDashboard" connectionString="" />
<add name="AzureWebJobsStorage" connectionString="" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Make sure to add the connection strings for AzureWebJobsDashboard and AzureWebJobsStorage like below. Change the Protocol, AccountName, and Accountkey based on yours.
<add name="AzureWebJobsDashboard" connectionString="DefaultEndpointsProtocol=http|https;AccountName=NAME;AccountKey=KEY" />
<add name="AzureWebJobsStorage" connectionString="DefaultEndpointsProtocol=http|https;AccountName=NAME;AccountKey=KEY" />
If you won’t add the above connection strings in your app. config file, then you will get the below exception.
System.InvalidOperationException: ‘Microsoft Azure WebJobs SDK Dashboard connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways:
- Set the connection string named ‘AzureWebJobsDashboard’ in the connectionStrings section of the .config file in the following format , or
- Set the environment variable named ‘AzureWebJobsDashboard’, or
- Set corresponding property of JobHostConfiguration.’
As the next step, Add or modify the code in the Program.cs file based on your requirement.
Now, the time to publish or deploy your Azure WebJobs to Azure cloud.
How to deploy Azure Webjobs to Azure
Well, let’s discuss the quick steps to deploy your Azure Webjobs to the Azure cloud from Visual Studio 2019.
- Right-click on the project and select the Publish option as highlighted below.

2. Now, you need to select a publish target so select the Create New option to create a new app service. You can also select Existing option to select an existing app service. Finally, click on the Create Profile button.

3. Provide the below details on the Create new App service window.
- Name: Provide a name for the App service.
- Subscription: Choose a valid subscription that you want to use here.
- Resource Group: Select an existing resource group that you have or you can use the default resource group that is created, you can also click on the New button to create a new resource group.
- Hosting Plan: Select a hosting plan or you can use the default hosting plan that is created, you can also click on the New button to create a new hosting plan.
Finally, click on the Create button to create the new app service.

4. You can check out the all the properties like Site URL, Webjob name, Webjob type, Username, Password, etc on the Publish window. Finally click on the Publish button to publish the Azure Webjob to the Azure cloud.

Now, as the next step, let’s cross-check if the Azure Webjob is actually deployed or not.
- Log in to the Azure Portal and search for App Services.
You can able to see below that the app service has been created successfully.

- Click on the App service and then on the App services window, click on the Webjobs link from the left navigation and you can able to see my Azure webjob has been deployed sucessfully.

Run the Azure Webjob using Azure Portal
To run the Azure Webjob, you need to follow the below steps.
- Right-click on the Azure Webjob –> Select Run option.

2. Click on the Yes button on the next window to run the selected webjob.

How to check the logs of the Azure Webjobs
It’s quite simple to check the logs of the Azure webjob or the status of the Azure Webjob from the Azure Portal using the below quick information.
- Right-click on the webjob –> select the Logs option.
Or,
You can also click on the Logs option from the top as highlighted below.

How to Delete Azure Webjob using Azure Portal
Now, if you don’t want the Azure webjob anymore, you can delete the Azure webjob using the below quick information.
- Right-click on the webjob –> select the Delete option.
Or,
You can also click on the Delete option from the top as highlighted below.

2. Click on the Yes button to confirm the deletion process in the next window.
You may also like following the below articles
- How To Create Azure Functions In Visual Studio
- Create Azure Function using Visual Studio Code and PowerShell
- How To Find Azure Functions Run Time Version
- How to Create And Consume Azure Function From ASP.NET Core
- How Much Memory Available For Azure Functions
Wrapping Up
In this article, we have discussed how to create and deploy Azure Webjobs and the below topics
- What is Azure WebJobs?
- How to deploy Azure Webjobs to Azure
- Run the Azure Webjob using Azure Portal
- How to check the logs of the Azure Webjobs
- How to Delete Azure Webjob using Azure Portal
Hope you enjoyed this article !!!.