Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy console webjob app to azure App service containing a webapi using azure devops pipelines

I have 2 webAPI’s written in .net core 2.2.The 2 web api’s are triggered by web jobs which are console Apps in .netcore 2.2. They are all different projects and in different repositories in Azure DevOps.

I am trying to deploy the web Api's together with the webjob into 2 web app services(eg: WebApi1 + Web job1 into App service1 and WebApi2 + Web job2 into App service2) in Azure using the Azure DevOps build and release pipelines.

I am able to add the webjobs manually into App Service from Azure portal and it works fine.But I want to deploy it using Azure DevOps pipelines.

I tried different ways to publish the web jobs(console apps) with the web api in the app service, like trying to publish it to App_Data folder from Azure DevOps.

I mainly followed the blog below.

https://www.andrewhoefling.com/Blog/Post/deploying-dotnet-core-webjobs-to-azure-using-azure-pipelines

But when I try to publish the webjob it overwrites the web api code(all the 4 projects have seperate build/release pipelines). The webjob code gets deployed in the site/wwwroot folder rather than the site/job folder.

enter image description here

My Build steps:

enter image description here enter image description here

My Release steps:

enter image description here

I am not sure what I am doing wrong. Is there a way to copy the webjobs files into the same app service without overwritting the actual webapi code?

like image 698
NewBieDevRo Avatar asked Jun 03 '19 20:06

NewBieDevRo


People also ask

How do I deploy app Services in Azure DevOps?

List the stage name as DEV and click on Add an artifact. Select project and source (build pipeline), then choose the default version and press Add . Next, click on Task (below the DEV), select Run on agent and select agent pool as Hosted VS2017 . In the Display name box , add Azure App Service Deploy .


1 Answers

I asked this question a while on github repo azure-webjobs-sdk but the answer didn't help me as well...

i tried the following and it worked out for me:

  1. In Azure Portal navigate to: App Service > Configuration > Path mappings > Virtual applications and directories

enter image description here

  1. In DevOps configure your build pipeline like: enter image description here

  2. configure your release pipeline like: enter image description here

configure the task:

enter image description here

like image 112
Daniel Avatar answered Sep 30 '22 14:09

Daniel