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
Related
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.
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:
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.
My Build steps:
My Release steps:
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?
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:
In Azure Portal navigate to: App Service > Configuration > Path mappings > Virtual applications and directories
In DevOps configure your build pipeline like:
configure your release pipeline like:
configure the task:
I got it working by following below steps sequentially -
Deploy Webjob using App Service Deploy task which has below setting for deployment method -
Deploy API using App Service Deploy task which has below settings -
After these two steps, API and webjob work seamlessly in same app service.
I have a zip file in a container under an Azure Storage account.
I want to download this zip file as a pipeline task after the deployment of the .NET Core app to an Azure App Service slot (Azure DevOps). The front-end (index.html) of this app is in this zip file, which must be downloaded/extracted to the wwwroot.
I tried it with a Azure PowerShell script: InlineScript task but there is no wwwroot folder available as seen in the Kudu debugconsole of the App Service.
Is there a(n easier) way to achieve this?
I'm not sure I quite understand the issue (you're deploying a webapp, then you want to download another zip from blob storage, and deploy that to the same webapp?), but I'll have a stab at it.
Deploy the webapp with Azure App Service Deploy task as normal.
Add an Azure PowerShell task, which will run on the Build Agent, not on the webapp, so it won't see the wwwroot folder. It can however run Get-AzureStorageBlob to download the zip, save it locally in a local folder (like $(Build.ArtifactStagingDirectory)/tmp or something).
Have an Azure App Service Deploy deploy it ($(Build.ArtifactStagingDirectory)/tmp/*.zip) up, just make sure that you haven't selected "Remove additional files at destination" when you do the second deploy or it will wipe the first site out.
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