Deploying Multiple WebJobs from the Same Project in a Azure DevOps Release Definition? - azure-devops

So the way that we've structured our code is that we've got several projects in our solution that each have multiple webjobs. We've configured a manual way of releasing these multiple webjobs using the run.cmd files and copying over the pertinent run.cmd file to the root folder depending on which webjob we're trying to release.
I'm wondering if there is any way to do this via a build/release definition in Azure DevOps without having to tear apart the multiple webjobs into individual projects. These multiple webjobs also all live in the same App Service.

What you have done is the simplest way at present, you could just clone the process in Azure DevOps Build/Release Pipeline. There is not any way to do this in Azure DevOps without having to tear apart the multiple webjobs into individual projects.
We've configured a manual way of releasing these multiple webjobs
using the run.cmd files and copying over the pertinent run.cmd file to
the root folder depending on which webjob we're trying to release.
For example, in your build solution step define (add some copy file step to copy necessary files) :-
Visual Studio Build (Solution: ***.sln, MSBuild Arguments:
/p:DeployOnBuild=true /p:WebPublishMethod=Package
/p:SkipInvalidConfigurations=true
/p:PackageLocation="$(build.artifactstagingdirectory)\")
Publish Build Artifacts (Path to Publish: $(build.artifactstagingdirectory); Artifact Name: drop; Artifact Type: Server)
Create a release definition for this build definition and add a task
Azure App Service Deploy
Select your Azure Subscription and App Service name;
Select your Package or Folder:
$(System.DefaultWorkingDirectory)**\WebJob1.zip
You can similary create another Azure App Service Deploy task for WebJob2.zip and deploy as many webjobs you want through a single build and release pipeline.

Related

How to deploy app service with pipeline variables as an artifact to be downloaded?

I have an app service which is deployed to Azure WebApp for testing (this works just fine), but since this eventually shall be deployed to an on-premises solution I need to create a deployment package that I can download from either Azure Portal or from DevOps.
So far I have tried creating a Releases pipeline which picks up the build artifact and use the AzureBlob File Copy task to copy the artifact from DevOps to a storage account in Azure. The problem I have now is the the File Copy task does not set the varialbes I have in the Variable groups into the appsettings.json file (such as DbConnection and port settings).
What would be the best way to create a deployment package (with updated appsettings.json values) to be available for download either from Azure Portal or DevOps, without the need to create a dedicated app service in Azure for the deployment?
This is the steps I have at the moment, but as mentioned the configuration property for setting the varialbes are not available for the AzureBlob File Copy:
Pipeline Tasks and Variables
How to deploy app service with pipeline variables as an artifact to be downloaded?
You could try to use the task File transform (Preview) to update the appsettings.json file with the value in the variable groups:
Then we could use the Azure File Copy task to copy the artifact from DevOps to a storage account in Azure.
Note: The Source of the Azure File Copy task should be use the $(System.DefaultWorkingDirectory) instead of select the repo file:

ClickOnce deployment on Azure DevOps release pipeline

I am trying to create ClickOnce deployment on Azure DevOps release pipeline
I create signature, manifest, application, deploy files with certificate
But how can I create the exe and setup file (via Azure DevOps release pipeline)
But how can I create the exe and setup file (via Azure DevOps release
pipeline)
Check document Build ClickOnce applications from the command line: Msbuild has Publish target to build and publish the ClickOnce application. It will generate the setup.exe you want. See similar hint here.
And all above is about doing that in local machine, to do similar job in release pipeline you can use msbuild task or Visual Studio Task with Publish target(/t:Publish as argument).
Then you'll get one app.publish folder where the files you want exist there:
This folder can be used for your further deployment.
In addition:
If you meet error like Unable to find manifest signing certificate in the certificate store, please check the suggestions in this issue.

Deploy Azure App Service and Webjobs using Azure Devops in .Net Framework

I have created Azure AppService and added Webjobs console application in a single solution. I'm trying to build the solution through Azure DevOps build pipeline and Deploy the package through Octopus. When I build the solution there files required for Appservice such as Web.config and Global.asax are missing from Artifacts folder. so When deploying that package is breaking the AppService.
I tried to change the MSBuild arguments while building the solution. the current MSBuild arguments are as follows:
/p:DeployOnBuild=true/p:WebPublishMethod=Package
/p:Configuration=$(BuildConfiguration) /p:OutputPath=.\bin\ /p:PackageTempRootDir="$(build.artifactstagingdirectory)\temp" /p:packageAsSingleFile=true /p:TargetProfile=Cloud
I suspect, while building the Webjobs it is removing the App Service files, so the generated package does not contain all the required files. My Build pipeline looks like below.
My Artifacts folder Creates a Nupkg file which has following files.
If the App Service is deployed alone, It is working fine,Please suggest me the way I can deploy both from single solution and one Build definition on Azure devOps.

deploy app to on-prem environments with azure dev ops

I'm building an Azure DevOps pipeline to deploy a custom-build powershell application to several on-prem environments that we support. I configured the required agent pools and installed them as a service on the on-prem environment.
Next, I have set up my pipeline in Azure DevOps, selecting a GitRepo:
Build (with the steps: Use Nuget, Nuget Restore, Build solution, Update version, Copy Files, and Publish build Artifact)
Release (with step: Publish Build Artifact)
Some things are unclear for me:
Do I need the Publish Build Artifacts twice? Can the Build pipeline
end with Copy Files step, and that the Release pipeline picks up this
artifact?
It is my understanding that the release publishes the app to the
on-prem environment (in my case). Where can I set a custom path (ie:
C:\deployed_apps) where the app needs to be deployed? When I tested
this pipeline, I got errors that the path I created using an variable
was not found.
What am I missing in my setup to get this pipeline working?
As #Shayki Abramczyk
pointed out this task is not for deployment, it just upload your Build Artifacts to azure devops server where your release pipeline can download directly.
In your case, if you want deploy your application to several on-prem environments, You need to create a deployment group first, A deployment group is a logical set of deployment target machines that have agents installed on each one. You application will be deployed to those machines in a deployment group in release pipeline. Check here for more details about deployment group.
After the deployment group is created, you can add a deployment group job by click the 3 dots, and then specify your deployment group as below pic shows, You can then simply add a copy file task or other deployment tasks to deploy your application to your on-prem machine.
In the release pipeline you shouldn't use the Publish Build Artifact. in the end of the build you put this step, what this step does? upload your artifacts to the Azure DevOps or to a file share. now in the release pipeline you choose the build artifact (in the left pane). the first thing that the agent does when the release pipeline started is to download the build artifacts to the agent. now you need to take them and deploy it to your environments. how? it depends which kind of application is (it can be just copy files, it can be deploy to IIS, etc.).
You can put the path in the variables tab and use this variable when you deploy the app (with copy files task, for example).

Azure DevOps SetUp - Mulitple Project / WebJobs under Single Solution

We have about multiple Projects in a single Solution.
2 projects needs to be deployed as Azure Web App
10 projects are web jobs which needs be deployed to one of the Azure web app
Can someone guide me on how to setup the deployment pipeline for Continuous Integration.
This is one option:
Setup build pipeline so that build will produce ready to install packages. An easy way to achieve this is to use Build solution Task and add following parameters into MSBuild arguments:
/p:TransformConfigFiles=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:OutDir="$(build.stagingDirectory)"
(+ of course you need publish symbols path and publish artifact task which are created by default)
Now when you build your solution you should have ready to install packages (zip files).
Next we need to setup deployment pipeline. Here you should use Azure App Service Deploy task. All the other parameters except package or folder should be easy to setup if you have linked Azure subscription into Azure DevOps.In package or folder you can put: $(System.DefaultWorkingDirectory)/**/(name of the zip package you want to deploy).zip.
Web jobs don't differ from apps much, so you should be able to setup their pipelines also with above guide.
For more information about web job deployment check this Microsoft example:
https://blogs.msdn.microsoft.com/tfssetup/2016/05/18/deploying-and-schedule-azure-webjobs-from-vsts-to-azure-web-app-with-bonus-cron-scheduling/