Configure TFS Online "Azure App Service Deploy" Step - azure

We have an ASP.NET Core application build in TFS and we want to deploy the built files to multiple Azure App Services. It appears the solution is to use multiple Azure App Service Deploy steps. While testing this we are able to get the output zip copied to the App Service but we can't figure out how to copy all the raw output files. Can anyone help us understand how to do this?

Base on the screenshot you will copy the files from $(build.stagingdirectory) to App Service.
So, if you want to copy other files, then you can add a Copy Files task before the Azure App Service Deploy step to copy the files to $(build.stagingdirectory) first.
By default, the value of Package or Folder is something like
$(build.artifactstagingdirectory)/**/*.zip
So, you can try to use $(build.stagingdirectory)/** to copy all the files to App Service.
See below articles for more information:
How To: Extend your deployments to Azure App Services
Deploy a web app to Azure App Services

Related

exclude folder from delete in Azure Web APP deploy task

i've two applications (frontend and backend) in same Azure Web APP (Windows Plan).
The backend application is under wwwroot\back folder
The frontend application is under wwwroot folder
When i deploy the frontend using azure web app deploy task under Azure DevOps, the backend folder will be overwritting. Also , the same thing when deploy backend
Any idea , to do a exclude of same folder before deploy the front ?
Any idea , to do a exclude of same folder before deploy the front ?
In Azure Web APP deploy task, there is no such option could meet your requirements.
You could try to use Azure App Service deploy task.
In Azure App Service deploy task, you could enable the Select deployment method option and input the -skip argument
For example:
-skip:Directory=\\back
OR
-skip:skipAction=Delete,objectName=dirPath,absolutePath=wwwroot\\back
-skip:skipAction=Update,objectName=dirPath,absolutePath=wwwroot\\back
Then the target folder will skip the option to modify the content.
For more detailed information, you could refer to this ticket:Azure Pipelines: Exclude folders using Azure App Service Deploy and this blog: Demystifying MSDeploy skip rules.

Deploy multiple Application to the same Azure web app viaAzure DevOps

I've a two applications, backend and frontend, hosted on the same Azure web app (os : windows).
Actually, i Deploy the two artficats via FTP/S.
I use wwwroot folder to the front and a subfolder in wwwroot folder to the backend
I would use Azure Devops to create a Azure Release to deploy the two application to my web app.
I can't use two app service for the backend and the frontend.
What is the best approch to deploy ? and It's possible to specify a subfolder target in Azure App service into Azure release ?
Regards
It is impossible to specify a subfolder to deploy to in azure release pipeline using the deployment tasks. The artifacts will be deployed to wwwroot folder by default.
However,You can use copy files task in your release pipeline to copy the backend artifacts into the subfolder which resides in the frontend artifacts folder. And then deploy the frontend artifacts folder which contains the backend artifacts in its subfolder. See below:
You can also run Kudu rest api in azure powershell task to deploy to azure web app service.
You can first use the command api to create a subfolder in wwwroot.
{
"command" = 'md subfolder',
"dir"='D:\home\site\wwwroot'
}
Then you can deploy the backend artifacts to the subfolder using zip deploy api
$apiUrl = "https://{sitename}.scm.azurewebsites.net/api/zip/site/wwwroot/subfolder"
Please check out this blog for more information. See this thread for example using azure powershell task to call kudu rest api

Deploying several webjobs and a webapi to a single App Service on Azure with Devops

I am trying to deploy 4 or more webjobs and a webapi to a single app service on Azure, using Azure Devops.
I have read previously that to deploy a webjobs i needed to prp my artefact with the following tree organisation : webjobs/app_data/jobs/continuous ou webjobs/app_data/jobs/triggered
So i made it so that my build prepared the artefacts organised like this :
artefact
/WebApi
/...dlls and stuff
/webjob
/app_data
/jobs
/continuous
/webjob1
/...
/webjob2
/...
/triggered
/webjob3
/...
/Webjob4
/...
When i deploy webjobs, using the task Azure App Service Deploy, and pointing the folder webjob, i can see my webjobs being deployed all well.
But when i try to deploy the webApi as well, it doesn't work.
I first tried to deploy webjobs and webapi in two separated task (still using Azure App Service Deploy ) but one was overwritting the others.
I then tried using one task Azure App Service Deploy, by providing the top folder containing WebApi and webjob, but this doesn't seem to work.
I suppose there is a simple thing to do here, but i don't seem to be able to work it out ...
Is there any people who have managed to do this ?
Check this case: How do you deploy an Azure WebJob and App to the same App Service via VSTS?
You need to associate webjobs with web app, by right clicking your Web App project in Visual Studio and select Add > Existing Project as Azure WebJob and follow the wizard.
The webjobS are included in the web app package, then you just need to deploy web app to azure app service.
It will generate webjob’s package too during publishing (that why there are two zip files), but you just need to specify web app package in Azure App Service deploy task. (Check Publish using Web Deploy option). Make sure the "Exclude files from the App_data folder" is unchecked:

Can I use VSTS Release Manager to deploy a single web job under my app service without deploying the entire app service?

I have an Azure App Service which contains 5 web jobs. I have VSTS Release Manager set up to deploy the entire app service, which successfully updates my web jobs as well.
However, I want to deploy only a single web job without deploying the entire app service. I have the build set up successfully for the web job. But I am struggling with the configuration of the release pipeline. I've tried two methods:
1. Copy Files
Using this method, I am using $(build.artifactstagingdirectory)/app_data/jobs/triggered/[my-web-job-name] as the target folder. But when I go to find the files in the production environment (using Kudu console), they are not there. Since this completes "successfully", I think the target folder might be set up incorrectly. What target can I specify to get the files in the production environment? (as a side-note, do I need to do something special to have it deploy the contents of the drop.zip file?)
2. Azure App Service Deploy
This method seems to target the entire app service, and not a single web job. I have not tried running it using this method, as I am concerned it might wipe out my entire app service and replace it with my single web job. My thought is that there may be a way to set up a "sub-folder" of the app service to deploy into. But I'm not seeing any setting like that in any of the options. Is there a way to set up the "Azure App Service Deploy" to deploy to a single web job folder?
Or, is there an entirely different way to deploy a single web job?
I think you need to make sure the structure of your artifact matches the subfolders exactly. See here: http://www.bravegeek.com/2016/12/03/Deploy-WebJobs-from-Team-Services/
Relevant part:
In your Build definition, add a Copy Files step after the build step.
Set these properties
Source Folder: src/WebJobTest/bin/$(BuildConfiguration)/
Contents: **
Target Folder: $(build.artifactstagingdirectory)\WebJobTest\App_Data\jobs\continuous\WebJobTest

How to deploy NodeJS project to Azure websites?

We have a NodeJs project we are building with TeamCity, then using FTP, uploading the built files to our Azure web app (.azurewebsites). The project contains thousands of files, so the FTP upload times are very slow (takes a very long time). We would prefer to package the build as a ZIP file, then upload the ZIP with FTP (much faster). However, how do we unzip the ZIP file on Azure using script?
Or is there a better way to deploy our build to our Azure web app?
NOTES:
This is an Azure web app service, does not live on a VM
Our process needs to be automated with script to support CI/CD
Deployments with Git and other repos are not feasible
You can use the Kudu API or MsBuild to deploy an app (web app or Function) to Azure App service. The deployment is usually done in 2 parts:
Deploy the app service using ARM templates
Deploy the code/App using one of these methods
If you're using VSTS, there are templates for both steps and make it a 2min process to setup. If you're not using VSTS, the Kudu API is he best way to solve the problem.
You can find more information here : https://github.com/projectkudu/kudu/wiki/REST-API
You can also use the Azure PowerShell Management cmdlets to achieve the same. However, this is at the moment only supported on Windows

Resources