Angular application from Azure Pipeline into App Service Directory - azure-devops

We have an Angular 7 application on one git repository and an ASP.NET Core 2.2 Web API on another git repository. We use Azure pipelines to deploy both repos into an Azure App Service.
I have successfully been able to configure the Web API to deploy to the root directory and the Angular client into a wwwrooot sub directory.
However, in order to achieve this I need to configure the wwwroot sub-directory as an application, which makes the application fail with HTTP 404. Once I change the settings to be "Directory" in the Azure app service, everything works as normal.
Is there a way to have the Angular pipeline deploy to the sub-directory while configured as Directory instead of Application?
Thank you,

I solved my issue from within the pipelines. Following this post (VSTS build with multiple repos) I added the FE artifacts to the pipeline and simply copy it's dist contents to the wwwroot folder of the API build folder. Then I simply deploy everything to App Services and now both the API and Angular App are deployed on the same server and working.
Hope this helps someone.

Related

Azure App Service Web app deploy puts files in wrong folder

I am just getting to grips with deploying my asp.net application via release pipeline in Azure Devops.
Previously, I have been deploying my web app directly from Visual Studio using publish which works fine.
But when i have set this up in a Release pipline in Azure dev ops it doesnt work, when i try and load the page i just get:
'You do not have permission to view this directory or page'
and looking at the deployed files via Server Explorer I can see the files are in a 'Drop' folder
But when looking at the deployed files when deployed directly from VS it looks like:
I know this must be down to how I have configured either my build or release pipeline but i cannot see where.
Release pipeline
I see here that i set the path to the Drop folder, but i added that as without it it was failing....i think

Copy or Rename file in sub folder under Web App through azure release pipeline after web deploy

I have an Azure DevOps release pipeline, deploying my code using Web Deploy to Azure Web app to different environments (Dev/ SIT/ UAT/ PROD). Now, I need to include a task to copy/ rename one Configuration file (environment specific), which is inside 'Config' folder, to another file inside the same folder. Please note, the config file is not under the root folder of the web app.
Is there a way to accomplish this using 'post deployment action' or command line script task? I couldn't understand how can I refer the source folder of the web app for the copy operation. I was referring the following page but couldn't find one that will help me to achieve the task. Any help is appreciated.
https://learn.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=azure-devops&tabs=batch
The Post deploy action script is running on azure (through Kudu API): Command
So, if the file is existing on the azure web app, you could copy it through Post deploy action script, for example, Site.css is in wwwroot\Content folder after deploying, then the script could be like this:
Copy Content\site.css Content\site1.css /a
Otherwise, you could store the necessary data in App settings or Configurations of Azure Web app.

How to publish WebApp as Azure Virtual Application from TFS Release (vNext)

I need to publish 3 webapp to azure using release manager from TFS, and I need all of these 3 apps inside wwwroot subfolder:
wwwroot\app1
wwwroot\app2
wwwroot\app3
This is because I have a azure virtual application pointing to each of this folders.
I have a release for each app. Each app should deploy not to wwwroot, but to a folder inside wwwroot (app1, app2 or app3).
At this moment what I'm doing as a workaround is deploying a package (zip) with the name of the folder that I need (app1, app2 or app3), however, this is just a workaround, because if I activate "clean" in the release task, this clean all wwwroot folders and clean the other apps.
Is there anyway to deploy using some Task to a specific folder instead root folder (wwwroot)? Or, is there a way to deploy to azure virtual application?
If not, is it possible to send me a powershell command to delete a specific folder in the wwwroot?
I'm using "Azure Web App Deployment" task that uses Publish-AzureWebsiteProject PS command, but I don't know if it's possible to send some argument to send this to a specific folder inside wwwroot? Is there some argument to do that?
Thank you all for the availability
You could directly use the AzureRM Web App Deployment task released by Microsoft which allows for virtual directories.
Update
It's a build-in task called Azure APP Service Deploy
The task you are using-- Azure Web App Deployment is deprecated.
NOTE: This task has been deprecated. To update Azure App Services using Web Deploy or Kudu REST APIs, use the Azure App Service
Deploy task.
We recommend you replace the Azure Web App Deployment task with the
Azure App Service Deploy task in all your build or release
definitions.
I found another solution. Using cURL to upload by FTP and I can control each individual folder.
Anyway, if someone knows how to deploy directly to a virtual app directory, please provide answer :)
Thank you

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/

Copy bower_components to Azure Web App using Visual Studio Team Services

With an Azure Web App that is deployed to via Visual Studio Team Services.
The 'bower install' build step works perfectly, as the next build step executes tests using these files and these tests pass.
After this, I need a method to copy the bower_components folder into the Azure Web App wwwroot folder. How do I do this?
You can use FTP Deploy to copy files to your Azure Web App folder. Check this link for reference: Windows Azure Website: Uploading/Downloading files over FTP and collecting Diagnostics logs.
To use FTP in your build easily, you can install FTP Uploader extension and then add it in your build definition to copy the files into Azure Web App via FTP.