Posted by Anuraj on Tuesday, February 19, 2019 Reading time :1 minute
This post is about how to deploy Azure Web Jobs using PowerShell. Recently I had to migrate an on premise application to Azure PAAS. The application has few console application, which is used to do schedule operations using Windows scheduled tasks. So as I migration to PAAS, I choose Azure WebJobs, so that I can easily convert the existing applications to Azure WebJobs. Only change I had to do is including two files -
run.bat file for execution of the console app and
settings.job file for the schedule interval configuration.
In this post I explaining how I implemented continuous deployment of the WebJobs using Azure DevOps and Powershell. So first I create a build pipeline for console application - this is a dotnet core console application. Here is the build and deployment pipeline.
In this pipeline, the
Generate configuration files task will generate
run.bat file and the
settings.job file. Here is the YAML code for the same.
Deploy WebJob task - this is also a powershell task, which deploy the WebJob zip file.
In this script, I am looking for zip file from the published artifacts directory, then uploading it to the Web App using Kudu REST API. You can create the authentication header by combining deployment credentials from the publish settings file and convert it to base64 encoded string.
This example was using Kudu API, you can use Azure CLI and API as well to deploy Azure WebJobs.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.