TFS to Server IIS Deployment -Include empty folders in App Data - iis

ON deploying from TFS 2015 to onpremise Server,it deletes empty folders in App Data Folder.I want to include the empty folders in AppData and set Read,write/full control permissions to that folder.I use WINRM IIS Web Deployment task.

This is how the feature has been designed. Take a look from our MSFT'S reply at this similar question: Publish Artifacts task does not copy up empty folders
I can confirm this is by design. I am assuming you are uploading
artifacts to Azure DevOps Service rather than to your own file share.
You should think of Azure DevOps Service's artifact storage more like
blob storage than a giant file share.
I see you say you need these empty directories at deployment time. Can
you create them as a step during the release rather than as a step
during the build? I would say that fits best with the build vs.
release abstraction.
Compressing all of your artifacts into a .zip before you copy them to
the artifact staging directory should also work. You will just have to
unzip them as part of the release.
As suggested, you can create the empty folders via a script to workaround the issue. It will also apply to the situation if you choose to publish to file share path. Besides, you could also zip the artifact and upload and unzip it during release.

Related

Azure - Proper way to deploy using Azure Local Git - wwwroot folder doesn't have the same contents as Azure Local Git

I am deploying our NodeJS application to our Azure App service using Azure's local git. What I am basically doing is making our CICD pipeline git commit our changes and do a force push to Azure's Local Git. Then, Azure will build the application from the committed files, which seems to be working fine.
But today, I have made a shocking discovery, after couple of weeks of deployment, the files in the wwwroot folder does not match the files in the Local Git Repo. The files that do not exist anymore in the Local Git repo are still in the wwwroot folder
For example, the git repo contains the following files under prisma/migrations
But in the Azure App service wwwroot folder, the same directory contains more than that:
So, these files are actually from previous deployments that do not exist in the latest version of the master branch of the Local Git.
Upon looking at their deployment step, I learned that they are simply copying whatever files are created in their deployment "Oryx/Kudu" deployment step into the wwwroot folder without checking if there should be files needed to be deleted:
If this is the case with this approach, is there a proper way to do this?
Or is there a quick way to clean the existing wwwroot folder first before their deployer copy the files?
Hope somebody can help.
Thanks!
If you use the Azure App Service Deploy task in Azure DevOps Pipeline to deploy your application and select Web Deploy method option, there is an additional option to Remove Additional Files at Destination.
If you check this option, the deployment process will remove any files at the destination where there is no corresponding file in the package that is being deployed.
In other words, it'll remove any left-over files from a previous deployment that are no longer required.
Please refer to the similar ticket: How to clean up wwwroot folder on the target Azure Websites Windows Server before each deployment in VSTS.

Where to find artifact in Azure DevOps Custom agent pool

I am using a custom agent pool in Azure DevOps. I have made a build and published the artifact but I want to update a file in artifact without creating a new build. how we can do that in Publish Artifacts task it showing that upload /home/ubuntu/myagent/_work/4/a to file container: #/9464/Artifact-Name.
I am logged in to agent pool server and checked all the directories but I couldn't find the file container location. Can any buddy help me to find the Artifact location in agent pool.
Thanks in advance.
Based on your drop location, you probably can't. The only way I imagine this would be possible is if you were publishing to a share location instead.
When you publish artifacts (that would be visible from the build summary), those are stored on the Azure DevOps database content tables and are immutable. As Jane Ma mentioned in a comment out about the local files:
The directory referenced by $(Build.ArtifactStagingDirectory) is
cleaned up after each build. [...] you can't edit published artifacts.
You can get them in agent pool's local file, but all local operations
are not synced to the Azure DevOps. If you want to do follow-up work
on this artifact, you need to run a new build to update it.

Azure devops build pipeline- publish artifact process

I have created the azure build pipeline for my website application. In this, there is a task of Publish Artifact Which I think supposed to publish a website. But right now it is publishing without the dlls. Means it contains the *.aspx and *.aspx.cs files. It supposed to create the dll files for *.aspx.cs files. Could you please let me know which publish option/task I am supposed to choose for my website. Which will be equivalent to the "Publish Web App" command in the azure build pipeline.
right now it is publishing without the dlls. Means it contains the
*.aspx and *.aspx.cs files.
For this issue, I tested publishing the website to local in vs. From the local file directory, we can see that the dll files are in the Bin folder. You can set the system.debug=true variable when running the pipeline, so you can track which folder the dll files are published to in the build solution step in the log.
About publishing artifact process:
Artifacts are the files that you want your build to produce. Publish artifact task is used to publish artifacts for the Azure Pipeline.
In the agent there are 3 folders: a, b and s. The variable $(Build.ArtifactStagingDirectory) point to folder a (artifacts). When you build the code all the code and the artifacts exist on folder s (sources), the best practice is to copy only the artifacts to folder a and then use the task "Publish build artifacts", in this task you take the artifacts from folder a and put them on Azure DevOps storage or in your file share.
If you save the artifacts in Azure DevOps you can access your artifacts from the build summary page or create a release pipeline. if you save them in a file share you can just access them there or in the release pipeline.
In addition, you can share your build definition and msbuild arguments for further investigation.

.net core azure pipeline deployment with editable folders

I have a .net core web app (NopCommerce 4.1) that I am attempting to setup a build and release pipeline for.
However, when I setup the pipeline my deployment is failing because it attempts to create a folder, but write rights do not exist. I have confirmed this with Kudu where I get an error message (409) when attempting to create a folder via the cmd shell.
NopCommerce requires a couple of folders to be editable, but azure pipelines deploys a zip folder and creates a folder structure that is read only.
I want to deploy to a dev, test, prod environment with a folder structure that is editable (as nopcommerce creates folders and writes files to them dynamically).
I followed the following YAML structure:
https://damianbrady.com.au/2018/10/11/what-yaml-do-i-need-for-azure-pipelines/
Is there a way to create a build / deployment that will deploy either:
1. The files without zipping
2. Transfer a zip, unpack into a folder structure with execute/modify/create permissions
1.The files without zipping 2.Transfer a zip, unpack into a folder structure with execute/modify/create permissions
We could use the Azure kudu Zip API to do that.
Note:It is not recommended for deployments Kudu's zip API.
Kudu Rest API is an effective way to move multiple files to your site, but zipdeploy is preferable for deployment For more information please refer to this document.
In your case, you could use a Powershell task with Powershell script to invoke Kudu Zip API to do that. For information about how invoke REST API with Powershell, please refer to this SO thread.

Unable to copy files and folders on azure while CI/CD

I am trying to deploy my node application on azure. The deployment is successful but as I check the KUDU console the files haven't updated. All the files and folders are the same as previous.
I am using Azure VSTS for CI/CD, as I tried to use "copy files" task for coping the files and "publish artifacts" task for deploying but it doesn't work. The task output in the console shows that it has copied the files but the KUDU console shows no changes.
See the screenshots for more context -
Copy files plugin SS, Copy files description, Publish artifacts
Actual result: The files and folders are not updated on every deployment.
Expected result: The files and folders must update on every deployment.
Your Copy Files and Publish artifacts tasks are part of your Build pipeline. The Publish artifacts task makes items you choose available as a named artifact to a Release pipeline, while the copy files task is usually used to explicitly separate files from the working directory into a staging directory. Technically speaking, this task isn't necessary, as the Publish artifacts task will allow you to put a source folder that doesn't need to be under the $(build.artifactstagingdirectory), but it is helpful to keep clutter out of build artifacts.
While Most of the tasks that are usable in the Build pipeline are also available in the Release pipeline, it is not true for all. It's not clear from your question, but you should probably be using the Release pipeline to actually deliver your product.
Using jobs run on deployment groups (collections of machines that have been registered as agents), or Azure App Service tasks you can specify how to get your software where it needs to go.

Resources