Azure Devops App Service Deploy Task Not Work Suddenly - azure-devops

I use [Azure App Service deploy] task in Azure Devops pipeline to deploy the artifact to an Azure App service.
Everything worked well before but today it not work suddenly. It failed when i tried to deploy the artifact to the production slot (the slot marked production). But when i tested to deploy to deployment slots, it worked well.
I just got an error message that has no much detail in the log
Cleaning up temp folders from previous zip deployments and extracting pushed zip file C:\local\Temp\zipdeploy\534hsvxr.zip (80.94 MB) to C:\local\Temp\zipdeploy\extracted
[error]Failed to deploy web package to App Service.
[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
Anyone got the same issue before?
Thanks

It seems to be a source control issue. Just try going to the App Service Deployment Center blade and click "Disconnect" to disconnect your deployment. And then try to deploy it again.

Related

After Azure DevOps release pipeline of a Java web app in App Service, URL still shows the default page

I am new to Azure DevOps. I am trying to perform small home lab projects. One of them is to deploy a "Greetings from Spring Boot!" web app in Azure Web App service with Azure DevOps pipelines, build and release.
I got the source code (Spring boot web app) from a YouTube tutorial and performed the tasks in the tutorial but using GitHub actions (Azure Portal/Home/Resources/select my App Service/Deployment Center/Settings/ configure as source a GitHub repository where my code is). This way was fine. The web page https://my-app-name-just-example.azurewebsites.net/ is showing the message in my source code, "Greetings from Spring Boot!".
But when I try to use Azure DevOps build and release pipelines on the same Azure Web App resource, accessing the URL shows the default web page "Hey, Java developers!". Both build and release pipelines show successfully completed.
https://imgur.com/a/thiMfBQ
From the Azure DevOps build release I downloaded the jar file (demo-0.0.1-SNAPSHOT) and ran it locally on my PC (java -jar \path\demo-0.0.1-SNAPSHOT) and http://localhost:8080/ displays the message in my source code. This means the build pipeline was correct. When I configure and run the release pipeline using as source the build from the build pipeline, the release pipeline shows successfully completed but the web app URL still shows the the default web page "Hey, Java developers!".
I checked https://my-app-name-just-example.scm.azurewebsites.net/wwwroot/ and the demo-0.0.1-SNAPSHOT.jar is there. I stopped and started the Azure Web App too.
Any suggestions? Thank you.
#Jason Pan, Thank you very much for the solution.
I used as a solution the startup command in a new Release pipeline configuration. In my case: "java -jar /home/site/wwwroot/demo-0.0.1-SNAPSHOT.jar --server.port=80". I noticed the name of the artifact in my case from the Build pipeline is artifactId+version from the pom.xml file, so demo-0.0.1-SNAPSHOT.jar .
Then I edited my release pipeline with this startup command, saved it, deploy it and I could see the in the Release pipeline /Initialize job logs the message "[PARAMETERS_STARTUPCOMMAND] --> [java -jar /home/site/wwwroot/demo-0.0.1-SNAPSHOT.jar --server.port=80]" . Deployment was successful. And now Web App URL shows the content of the source code, "Greetings from Spring Boot!". Previously it was showing the default content, the "Hey, Java developers!".
Thank you again.
You can add startup command on portal.
Like :
java -jar /home/site/wwwroot/app.jar --server.port=80
For more details, you can reader offical doc and related post.
1. Built-in images
2. Unable to start spring boot application deployed as a jar
3. Deploy a Spring Boot Gradle application to Azure App Service from an Azure Pipeline

Azure Devops Release not update Azure WebApp

I did an initial deployment to an Azure WebApp on Linux via a direct publish from Visual Studio. The code just echoes out some text and the page comes up successfully. I can update the text in the code and re-publish. And the new text displays on the web.
Now I am trying to deploy it via Azure DevOps rather than a direct publish from Visual Studio. I created a rudimentary build and release pipeline in Azure DevOps.
I updated the text echoed out in the code then ran the build pipeline followed by the release pipeline. The Deployment status says that everything was successful. I went through the logs as well and there are no error messages. However, the website page text has not changed. Also restarted the App Service in Azure but the change is not reflected.
The release pipeline has one artifact which is linked to the latest build. And one stage which is "Azure App Service deployment" with the right subscription and the right App Service Name linked.
Release Pipeline
Any idea what I might be missing?
Here is the output from the deployment step -
Blockquote##[section]Starting: Deploy Azure App Service
==============================================================================
Task : Azure App Service deploy
Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
Version : 4.163.9
Author : Microsoft Corporation
Help : https://aka.ms/azureappservicetroubleshooting
==============================================================================
Got service connection details for Azure App Service:'myAppName'
Package deployment using ZIP Deploy initiated.
Deploy logs can be viewed at https://myAppName.scm.azurewebsites.net/api/deployments/xxx/log
Successfully deployed web package to App Service.
Successfully updated deployment History at https://myAppName.scm.azurewebsites.net/api/deployments/xxx
App Service Application URL: https://myAppName.azurewebsites.net
##[section]Finishing: Deploy Azure App Service
Thanks in advance, Jake.
I was able to create an empty Azure Service directly within Azure. Then pushed the code to this new Azure Service via DevOps. Now it seems to be working as expected. Only other difference is that I had created this as an App for Windows rather than App for Linux. Anyway, the update is working now.

Azure Function deployed successfully, but not working

I am facing a weird problem. I deployed my code using Azure DevOps Pipeline Release - it ran successfully, however, the code is not reflecting in Azure Function App.
Here is what I am doing:
Created a Release pipeline with a "Deploy Azure App Service" task. It picks up artifacts from a build pipeline and is configured to deploy to a Function App using Service Connection
When the Release pipeline is triggered it runs through all its steps, and I get a success (see logs below)
However, when I open up Azure portal and navigate to the Function App, it continues to say "Now it is time to add your code" on the Overview tab, and I am not able to hit my API on that Function App
Surprisingly, On the Deployment Center tab of the Function App, it does show the details of the deployment (See details below)
I can also find the deployed zip file under D:\home\site\wwwroot when I log on to the Kudu console
Deployment logs:
Got service connection details for Azure App Service:'myFuncApp'
Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
Updated App Service Application settings and Kudu Application settings.
Package deployment using ZIP Deploy initiated.
Successfully deployed web package to App Service.
App Service Application URL: http://myFuncApp.azurewebsites.net
View on Function App Deployment Center Tab:
Deployed Successfully to production
Source Version 6d9c8340ba Build 20190411.1 Release: 3
The Function App endpoint is working, (throwing a generic welcome page) confirming the Function App itself is healthy, but I am not able to access my API.
Additional updates
Here is the structure of the .zip file that is being uploaded to d:\home\data\SitePackages as a part of the zip deploy from Azure Pipelines:
/host.json
/package.json
/proxies.json
/package-lock.json
/func_name/index.js
/func_name/function.json
/node_modules/**
The same code is working locally.
Note: When I go to the Deployment Center tab, I do see this error message, but I think this is related to Continuous deployment through Function App
We were unable to connect to the Azure Pipeline that is connected to this Web App. This could mean it has been removed from the Azure Dev Ops Portal. If this has happened, you can disconnect this pipeline and set up a new deployment pipeline.
Please help me. What can be going wrong?
I was finally able to troubleshoot. #4c74356b41 pointed me in the right direction as the key issue was the package.
Below was the issue:
I had added an archive step in the build pipeline. This was causing the artifact to be zipped before publish
In the release pipeline I was using Azure App Service Deploy task. This internally uses Zip Deploy where App type is set to Azure Functions. Thus, it was zipping my zipped file.
When I remove the archive step, the double zipping was avoided, and it started working.

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

TFSService and multiple cloud services - can't unlink

I have 2 cloud services, live and staging, and I couldn't get staging to deploy from a TFSService build correctly - it kept either not deploying or deploying to live. The live cloud service is the one I originally created some time ago. I've deleted all builds for both services.
So I've tried to unlink both services in an attempt to relink just the staging one. Problem is that I can't unlink the live cloud service via the Azure portal. I get "Unlink TFS failed to complete cleanly. All info was removed from the Portal, but some might remain on TFS Hosted Services".
I've disassociated my TFS Service in my visualstudio.com admin area but I still get the error.
Can anyone advise what I can try next please?