Is there a way to deploy multiple zip packages from a folder of the artifacts using Azure Web App deployment task in Azure DevOps? - azure-devops

There are multiple CS project packages in a folder of my artifacts that needs to be deployed into the web app with multiple Virtual Directories. When I give "$(System.DefaultWorkingDirectory)/*/*/APIs/*.zip" as my Package/Folder pattern to deploy it says"
Error: More than one package matched with specified pattern:
C:\agent_work\r8\a**\APIs*.zip. Please restrain the search
pattern.

You can try unzip your package first in current directory :
Unzip "$(System.DefaultWorkingDirectory)\$(Package.PackageName)" "$(System.DefaultWorkingDirectory)\Build\Package"
then give the path to your folder like this instead of '$(System.DefaultWorkingDirectory)///APIs/*.zip' :
Build\Package\web
Virtual Directory creation is separate part. You can create virtual directory before deploy web app content.

Related

Missing files from bin folder after azure zip deploy

I am using azure build pipelines to deploy my custom solution into an existing one, but after deployment some dlls from the existing solution get removed, I am using zip deploy method and after some research I found this method will delete files that were part of a previous deployment and are not in The deployment artifact.
based on Microsoft article here for zip deploy, it says : Deletion of files that were left over from earlier deployments.
It is a module that needs to be deployed on top of existing solution that has other modules as well, so i don't need other dlls to be removed, I just want to deploy my solution dlls on top of an existing one. any idea how this can be done ?
From the Zip deployment doc: https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push. When you use .zip deployment, any files from an existing deployment that aren't found in the .zip file are deleted from your function app.
You could try using "Web Deploy" method and disable "Remove additional files at destination" option.
Also, you could use "Exclude files from the App_Data folder" with additional arguments to prevent files in the App_Data folder from being deployed to or deleted from the Azure App Service. Refer to this ticket for details: Azure Pipelines: Exclude folders using Azure App Service Deploy

How do I deploy azure funtion app packaged as .nugpk using azure devops?

I have a build pipeline that generates .nupkg for azure function, when I try to release it the content gets deployed (I can see when I download the app content) but I cannot see the function.
Is it the case that azure artifact has to be .zip for azure function? I am able to deploy the angular and .net core app using .nupkg without any problem!
Is it the case that azure artifact has to be .zip for azure function?
You re right.
Currently, only .zip package files are supported.
That because:
Zip deployment is a feature of Azure App Service that lets you deploy
your function app project to the wwwroot directory. The project is
packaged as a .zip deployment file. The same APIs can be used to
deploy your package to the d:\home\data\SitePackages folder. With
the WEBSITE_RUN_FROM_PACKAGE app setting value of 1, the zip
deployment APIs copy your package to the d:\home\data\SitePackages
folder instead of extracting the files to d:\home\site\wwwroot.
You could check the document Run your Azure Functions from a package file for some details.
And there is state about that:
Hope this helps.

Error: More than one package matched with specified pattern: *.deploy.cmd. Please restrain the search pattern

Azure DevOps Build artifact drop contains following files:
Project1.zip
Project1.deploy.cmd
Project2.zip
Project2.deploy.cmd
These files are a result of build output of a single solution.
I want to deploy Project1 web app to Azure.
I set up a release definition and add a Deploy Azure Web Service task to it. The task's path to package file or folder contains value which matches exactly one file Project1.zip . Nowhere do I specify any *.deploy.cmd files.
When the release executes it fails on that task with error:
More than one package matched with specified pattern: *.deploy.cmd. Please restrain the search pattern.
The only work-around I've found is to delete 2.deploy.cmd so that the deploy dask won't find multiple files using specified search pattern. But I would like to not delete it, especially because I would like to eventually deploy Project2 too. How to solve this problem?
I would suggest that you locate your artifacts in different folders.
You can use a Powershell task before you invoke your web deploy task to
create two folders
move the .cmd and .zip folders for project 1 into one folder
move the .cmd and .zip folders for project 2 into the second folder
You can then invoke your web deploy task against the folder path for project 1 and this should side-step your issue.
You can also extract the zip file and then point the web deploy task at the folder instead which may also help you if the above is either too complex or fails for your specific use case.
Don't use a wildcard. Specify an exact path to the file you want to deploy. If you want to deploy multiple things, use multiple tasks.

Azure devops - perform same action for a collection of directories from drop

From Azure Devops (VSTS), I have an build artifact package that has a directory structure like this:
Drop
Service.First
Service.Second
Service.Third
Service.Forth
etc...(several more folders)
Each folder contains a service.
The folder is named the same as the service executable.
In my release pipeline, is there a way to iterate over each folders, copy the contents into the program files directory, and install each service based on the name of the folder?
I am trying to avoid having to crate separate deployment group tasks for each service.

VSTS performs web deploy successful, but website does not work

I am trying to get Visual Studio Team Services (VSTS) to perform a web deploy of my app. According to the VSTS UI the web deploy is successful, but when I browse the deployed web site it shows the default IIS screen ("Welcome - IIS").
This is my publish step in the build pipeline:
This is my release definition:
This is the resulting deploy folder:
Build.log (with replaced values) - https://drive.google.com/file/d/1y6q2Cjr1gxBVMcHeh6n_r7qu-JpJFSyC/view
Do I need to add an additional step to the release pipeline to get the .zip files extracted?
You do not need to add an additional step to extract your zip, but you need to tell the IIS Web App Deploy task to deploy your zip file and not a folder. You have specified a folder for the Package or Folder input, so the task is doing exactly as you told it to do, deploy the specified folder.
If you only have one zip file in your build artifacts, the default value for this field, $(System.DefaultWorkingDirectory)\**\*.zip, will pickup your zip file and correctly deploy it. If you have multiple zip files in your build artifacts, you will need to specify the full path to the zip file in order for it to deploy.