How to combine multiple azure artifacts to one web deploy in the release process - azure-devops

I have a website which is the combination of 3 separate artifacts.
The base files for Sitecore (a CMS, best practice is to keep it separate from your own code repo), this artifact is just files
The custom logic for the web site (.net) which is compiled into a web deploy package
An additional module that we only release to the dev server. This artifact is just files (2 dll's and a config file)
At the moment to deploy to our dev server I have 3 IIS Web App Deploy tasks to release to IIS on a VM. The first removes the existing files and publishes one artifact and the next 2 just publish the additional artifacts.
However this feels really wrong and that it should all be done in one task. It's also not particularly fast having 3 separate processes to deploy files.
How can I set this up better? Speed is a big concern as this would currently take the site out for about 10 minutes while the deploy happens.

combine multiple azure artifacts to one web deploy task in the release
For this issue,I think one 'IIS web app deploy' task could not achieve this feature.
I test with the wildcard provided by default: $(System.DefaultWorkingDirectory)\**\*.zip
Then I get this error:
From the error message ,it presents that we can not select more than on package with the search pattern, I think this could be due to the limitation of 'IIS web app deploy' task, only one artifact can be specified in an 'IIS web app deploy' task. At present, to deploy multiple artifacts can only be achieved through multiple deploy tasks.
You can make your request to the IIS Web Application Deployment task in git hub.

Related

Setting up build and deployment for a solution which have three web projects that needs to be deployed with Azure DevOps

I have a solution in VS where I have multiple projects but three of them need to be deployed in different azure web applications.
I have read tutorials where all of them show you these simple steps:
Setting up a build (pointing a .sln file)
Getting an artifact in a .zip file
Setting up a release pipeline where you select the artifacts (.zip file) and select the azure web application you want to deploy the artifact.
All that is fairly simple and works well when you have one web application in your solution. In my case it doesn't work because I think the artifacts have multiple application and I'm not giving any information to the deployment pipeline how it will select only one application from the zip file for each Azure Web Application.
How is the better way to approach it?
You have to change your way of build. Instead of building the solution (.sln) you can use (.csproj) (assuming you have a common .sln file which is having multiple .csporj)
Steps:
Setting up the build - pointing projectA.csproj
Setting up the build - pointing projectB.csproj
Setting up the build - pointing projectC.csproj
Getting all the artifact in a separate zip ( 3 zip)
During the release you can deploy the corresponding artifact (zip) to your azure web apps
Lets say if you have a common .sln which is having a 3 separate .sln solutions. you can follow my answer here

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/

Deploy website on iis using VSTS

I want to deploy multiple websites on IIS using a single task in VSTS.
How to achieve this? Using a release definition i included a task which deploys the website on IIS. But in this arrangement,i need to create as many tasks,as many websites are there. what are the ways in which i can use either a JSON file or something and create a single task which reads the website names and port numbers etc from the Json and deploys all websites in one go.
There isn’t the official task that can deploy web apps together, you can create the build task through VSTS extension: Add a build task.
You can refer to the source code of IIS Web App Deployment Using WinRM extension to build a task extension.

VSTS: Release Management Deploying Artifacts to IIS on Premise

I am using VSTS Release management to deploy artifacts to IIS websites. I have several Web applications and web services to be deployed. So, i am trying to figure out what sort of tasks that best fits my situation.
I have created a build definition with Visual Studio Build Task for projects as this one:
which works fine but i need to add a task for copying the artifacts Under IIS Website Directory.
The other approach is to use IIS web deployment as a task in Release definition, so I created the build definition as:
However, it expects a Publish Profile (the build fails because it can't find it). I don't need to create a publish profile for each project in the application because this would be too much work.
Is there is a workaround for that or what is preferred approach for this?
You can update your build definition to generate a web deployment package and upload it to artifacts. And then in Release Management, add a task to run "projectname.deploy.cmd" in the deployment package to deploy it to your IIS server. Refer to this link for details: How to: Install a Deployment Package Using the deploy.cmd File Created by Visual Studio.
And you can also enable FTP Publishing on your IIS server and add a task in your release to publish the artifacts via FTP. You may need this task:
FTP Uploader.
My Continuous Delivery with TFS / VSTS – Server Configuration and Application Deployment with Release Management blog post (with reference to some previous posts) has all the details you need for deploying your artefacts to target nodes using Windows Machine File Copy tasks then use PowerShell on Target Machines tasks to get them in to correct locations and to do token replacement and anything else that's required.
I would recommend using PowerShell DSC so that IIS is properly configured before deployment but that's not required. Where possible for web apps I favour keeping things very simple by creating artefacts that contain all the web files that are needed for a particular folder and then just using plain xcopy for the deployment.
If you need more control you can also use my MSDeploy VSTS extension to deploy a MSDeploy package
https://marketplace.visualstudio.com/items?itemName=rschiefer.MSDeployAllTheThings
https://dotnetcatch.com/2016/04/20/msdeployallthethings-vststfs-extension-is-public/

OnPrem TFS 2015.1 vNext - What step to Release to on premises IIS server?

I'm trying to use TFS 2015.1 on premise to build a CI pipeline for our dev & uat. I've created a vNext CI build, which builds fine. But when I want to add a deploy step for on prem IIS server, I only then see Azure Web Deployment options.
Ideally I wanted to add a step which uses the existing deploy (MS Deploy) profiles, which I'm able to use from VS2015 directly, using 'Publish'. However I see no option to do so.
How can I deploy the latest build to internal dev servers (not Azure)? I would like to use the MS Deploy option, unless there's a better way of doing it?
The fact that their is no option to starts to make me think there's probably a different way to accomplish it!
Thanks.
If you're able to upgrade to TFS 2015.2, web-based Release Management came out with it that works similarly to Build vNext with flexible and open-source tasks. You can also customize tasks.
Here's a link for IIS Web App Deployment from the vso-agent-task's GitHub repo where Microsoft stores updated versions of their tasks that you can download for web-based Build and Release Management.
I'll be publishing a blog about web-based RM with TFS 2015 Update 2 or VSTS on my website in the next few weeks. To give you an idea though, the starting point (for a web application) is a folder in your web project called WebDeploy (no significance - any name will do) that contains a PowerShell DSC script that configures the server, deploys the web files and then replaces any tokenised configs. To give you an idea see this post about how to use DSC to configure servers. (Only covers part of the final script though!) The next steps are:
In the build hub create a Website artifact - containing your web files and DSC script.
In the release hub for an environment use a Windows Machine File Copy task to deploy the artifact to a temp folder on the target node.
Then use a PowerShell on Target Machines task to execute the DSC script. After configuring the server the script copies the web files to their proper location, sorts out config using xReleaseManagement and cleans up the WebDeploy folder.
See this article for general details of the route I'm taking, but watch out as it has some errors eg the firewall instructions are incomplete (file and print sharing through the firewall needs to be enabled).
I can thoroughly recommend the PowerShell DSC route - I've had a few glitches but on the whole it feels very productive and the right way to be going.