Team Services Azure App Service Deploy failure - Virtual Application characters? - azure

I have 2 Azure App Service Deploy steps in a Team Services build, they have the same Subscription details. The only difference is that they target different virtual applications - the one that fails contains an é character, could that be the cause? Here the step output:
2017-01-17T16:04:22.8323742Z 8570d8e4-b732-4c45-87c5-619fe9343427 exists true
2017-01-17T16:04:24.5778681Z Got connection details for Azure App Service:'foo'
2017-01-17T16:04:24.6088690Z Running command: "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:getParameters -source:package="C:\a\1\a\Foo.zip" > "C:\a\1\s\parameter.xml"
2017-01-17T16:04:25.4027522Z Running command: #echo off
2017-01-17T16:04:25.4027522Z "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="C:\a\1\a\Foo.zip" -dest:auto,ComputerName='https://foo.scm.azurewebsites.net:443/msdeploy.axd?site=foo',UserName='********',Password='********',AuthType='Basic' -setParam:name='IIS Web Application Name',value='foo/bar-é' -userAgent:VSTS_foo_build_154_744 2>error.txt
2017-01-17T16:04:25.4027522Z if %errorlevel% neq 0 exit /b %errorlevel%
2017-01-17T16:04:25.4067519Z [command]C:\Windows\system32\cmd.exe /C C:\a\1\s\msDeployCommand.bat
2017-01-17T16:04:25.4157662Z 'C:\Program' is not recognized as an internal or external command,
2017-01-17T16:04:25.4167533Z operable program or batch file.
2017-01-17T16:04:25.4207534Z ##[error]Failed to deploy App Service.
2017-01-17T16:04:29.2496923Z ##[error]Error: Error: C:\Windows\system32\cmd.exe failed with return code: 9009
2017-01-17T16:04:29.2576899Z ##[section]Finishing: Azure App Service Deploy: foo-dev-global
It's almost as if the Powershell command itself is broken, I'm guessing by the special character.

It maybe not the special character causes that issue. I try to deploy the virtual Application with the special characters é , following is my detail steps. Hope it is useful. We also can get moreinfo about WebDeploy error code please refer to document.
1.Create a new build definition for the project
2.Select build solution corresponding VS version.
Before config Azure App Service Deployment, we need to create a WebApp in the Azure portal and the edit the appsetting to add the
Virtual applications info
Config the Azure App Service Deployment with service name and Virtual application created in the step3
5.New Queue build for the build definition
Then we can check that it deployed successfully from deployment log or from kudu.

This is now working as expected, without me making any changes. Having informed MS of the issue, I can only conclude they've released a fix to the build task.

Related

Azure Deployment Pool Agent Fails to install IIS

Goal
I'm trying to install IIS on remote server using azure devops. I have done this on other vm servers without issue.
Problem
When running this stage the Agent Errors with very little details
Agent Errors when installing IIS
Error
2020-08-11T19:06:19.1822182Z ##[section]Starting: IIS Web App Manage
2020-08-11T19:06:19.1984662Z ==============================================================================
2020-08-11T19:06:19.1985052Z Task : IIS web app manage
2020-08-11T19:06:19.1985379Z Description : Create or update websites, web apps, virtual directories, or application pools
2020-08-11T19:06:19.1985671Z Version : 0.5.15
2020-08-11T19:06:19.1985908Z Author : Microsoft Corporation
2020-08-11T19:06:19.1986227Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-management-on-machine-group
2020-08-11T19:06:19.1986625Z ==============================================================================
2020-08-11T19:06:21.2180244Z Installing IIS. This may take few minutes.
2020-08-11T19:06:46.1602426Z ##[error]The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077. Error: 0x800f081f
2020-08-11T19:06:46.1908491Z ##[section]Finishing: IIS Web App Manage
Stage Settings
steps:
- task: IISWebAppManagementOnMachineGroup#0
displayName: 'Manage IISWebsite'
inputs:
EnableIIS: true
WebsiteName: 'Default Web Site'
AddBinding: true
Bindings: '{"bindings":[{"protocol":"http","ipAddress":"All Unassigned","port":"80","hostname":"","sslThumbprint":"","sniFlag":false}]}'
CreateOrUpdateAppPoolForWebsite: true
AppPoolNameForWebsite: default
I solved this by stop trying to use the prebuilt IIS web app manage tool and ended up just installing iis via power shell command
Install-WindowsFeature -name Web-Server -IncludeManagementTools

Azure CD pipeline can't find build artifacts

Below is Azure error log from the Azure release pipeline.
2020-07-24T05:17:13.7712974Z ##[section]Starting: Deploy Azure App Service
2020-07-24T05:17:14.0464143Z ==============================================================================
2020-07-24T05:17:14.0465719Z Task : Azure App Service deploy
2020-07-24T05:17:14.0469391Z Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2020-07-24T05:17:14.0469849Z Version : 3.163.5
2020-07-24T05:17:14.0470410Z Author : Microsoft Corporation
2020-07-24T05:17:14.0470921Z Help : https://aka.ms/azureappservicetroubleshooting
2020-07-24T05:17:14.0471274Z =============================================================================
2020-07-24T05:17:16.0650643Z Got connection details for Azure App Service:'XXXXX'
2020-07-24T05:17:17.6576087Z (node:764) Warning: Use Cipheriv for counter mode of aes-256-ctr
**2020-07-24T05:17:17.6627737Z ##[error]Error: No package found with specified pattern: D:\a\r1\a\Drop<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.**
2020-07-24T05:17:22.9168975Z Successfully added release annotation to the Application Insight : XXXXX
2020-07-24T05:17:24.8686063Z Successfully updated deployment History at https://XXXXX.scm.azurewebsites.net/api/deployments/231595567842919
2020-07-24T05:17:24.8933576Z ##[section]Finishing: Deploy Azure App Service
P.S. I have checked build pipeline, I can download build Artificats, but it displays below warning.
[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'.
Assuming you meant you have solved the build artifact empty issue, but the release pipeline still had issue in Azure App Service deploy task.
As the error mentioned, there is "No package found with specified pattern: D:\a\r1\a\Drop", you need to check how you define the package, try format $(System.DefaultWorkingDirectory)/**/*.zip instead of $(System.DefaultWorkingDirectory)\Drop.
As task "Publish Build Artifact" publish artifact from $(build.artifactstagingdirectory), so we need add a task "Copy files" to copy your files ** from $(system.defaultworkingdirectory) to $(build.artifactstagingdirectory) **. which copied my build to stagingdirectory.

How to delete files in Azure kudu via VSTS after the deployment

How to delete files in Azure kudu after the deployment ? I wrote some Powershell script using Azure app service deploy task after the deployment using post deployment action step but I couldn't able to delete the files.
I have simple-test.log and simeple.txt files exist in azure kudu.Please help me to solve this issue.
Script:
if((Test-Path 'D:\home\site\wwwroot'))
{
rm simple*
Write-Host "Simple log file is exist,removed"
}
KUDU Log:
KUDU LOG FILES
Deployment Log Snap
using kudu you would need to put it under site\deployments\tools\PostDeploymentActions. then kudu will run it after every deployment automatically. All the ps1, bat, cmd under that directory would be run by kuku
you can also put it to a custom directory, but you'd need to tell kudu where to get it by setting this setting: SCM_POST_DEPLOYMENT_ACTIONS_PATH.
Reading: https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks

Azure DevOps release deployment failing Disk Space Error

I have an app I am trying to deploy through azure's DevOps pipeline. I have successfully deployed apps before, and the first build of this app deployed fine. However all subsequent builds have been failing at the deployment step. They seem to be specifically failing at the "Deploy Azure App Service" step, generating a ERROR_NOT_ENOUGH_DISK_SPACE error code.
The deployment terminal output shows the following errors:
Got connection details for Azure App Service:'MMOMarketTracker'
[command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\a\r1\a\_MMMarketTracker\build\build.zip' -dest:contentPath='MMOMarketTracker',ComputerName='https://mmomarkettracker.scm.azurewebsites.net:443/msdeploy.axd?site=MMOMarketTracker',UserName='$MMOMarketTracker',Password='***',AuthType='Basic' -enableRule:AppOffline -enableRule:DoNotDeleteRule -userAgent:VSTS_ba2ca09f-578d-4893-99ac-412c3f26fde5_release_1_9_9_1
2018-11-22T21:02:35.2302461Z Info: Using ID 'e7a243b1-97df-4ec2-b8d9-c679c2e35512' for connections to the remote server.
Info: Adding directory (MMOMarketTracker\s\.git\objects\15).
Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
at ChildProcess.<anonymous> (D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.4.16\node_modules\vsts-task-lib\toolrunner.js:568:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
[command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\a\r1\a\_MMMarketTracker\build\build.zip' -dest:contentPath='MMOMarketTracker',ComputerName='https://mmomarkettracker.scm.azurewebsites.net:443/msdeploy.axd?site=MMOMarketTracker',UserName='$MMOMarketTracker',Password='***',AuthType='Basic' -enableRule:AppOffline -enableRule:DoNotDeleteRule -userAgent:VSTS_ba2ca09f-578d-4893-99ac-412c3f26fde5_release_1_9_9_1
Info: Using ID '201db2e8-ee9f-4e39-9a29-2187cb7056bd' for connections to the remote server.
Info: Adding directory (MMOMarketTracker\s\.git\objects\15).
##[error]Failed to deploy web package to App Service.
##[error]Error Code: ERROR_NOT_ENOUGH_DISK_SPACE
More Information: Web Deploy detected insufficient space on disk. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_NOT_ENOUGH_DISK_SPACE.
Error: The error code was 0x80070070.
Error: There is not enough space on the disk.
at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath)
at Microsoft.Web.Deployment.DirectoryEx.CreateDirectory(String path)
at Microsoft.Web.Deployment.DirPathProviderBase.CreateDirectory(String fullPath, DeploymentObject source)
at Microsoft.Web.Deployment.DirPathProviderBase.Add(DeploymentObject source, Boolean whatIf)
Error count: 1.
##[error]Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
The first error seems to be caused by the remote server failing to add a git object. This error will usually occur 2-3 times each deployment, and will result in the "Retrying to to deploy the package" message shown.
The second error will happen once and will end the deployment. I have been to the link the error recommends and there is no help section for this type of error.
I downloaded the build file and it is only 49.3 MB large, and the Microsoft servers have a 10GB size for deployments. I am running on a hosted build agent, not a private one.
Other questions I found online similar to this are mostly unanswered. Some have been updated later to say the deployment started working for seemingly no reason.
Any help would be appreciated.
For anyone else who gets the same problem, I basically had too many other apps taking up space on my azure account. The article Brendan Green linked explains this.
(https://blogs.msdn.microsoft.com/puneetgupta/2017/06/06/azure-app-service-what-is-taking-my-disk-space-for-my-azure-web-app/)
By going to the Quotas page on any of your azure apps (in the azure portal) you can see how much space you have left.
This happens when you're out of staging slots in your pricing tier. So, a workout solution is to upgrade your pricing tier to acquire more staging slots.
The staging slots are used for testing and deployments before swapping them into production and it does not associate with your file system disk space.
You may be able to reclaim disk space by triggering the build agent cleanup process.

All but first deployment of Orchard CMS to Azure Web Apps Fails

In Visual Studio Online I have a scripted build that builds Orchard 1.9.1 from source then, using the Azure Web App Deployment task, deploys the compiled Web Deploy Package to Azure.
The first deployment to a fresh Web App instance works great and the system functions as expected. However, any subsequent deployment to the same Web App fails with:
Unable to perform the operation ("Delete File") for the specified
directory ("HtmlAgilityPack.dll"). This can occur if the server
administrator has not authorized this operation for the user
credentials you are using. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER.
The file specified in the error can be different, but the deployment fails consistently. The link in the error isn't of much help as the implementation details covered (IIS, root folder etc) are abstracted away in an Azure Web App.
Where should I look to fix this permissioning issue?
I went with the default build template for Azure Website when creating the build, details of which are below for info:
Build Step:
MSBuild Arguments:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)"
Azure Web App Deployment step:
Pertinent information for the build log:
2015-09-28T05:36:22.7928424Z Package= C:\a\d8c9303e\staging\Orchard.Web.zip
2015-09-28T05:36:22.7938416Z Slot=
2015-09-28T05:36:22.7938416Z AdditionalArguments=
2015-09-28T05:36:22.8028415Z packageFile= Find-Files -SearchPattern C:\a\d8c9303e\staging\Orchard.Web.zip
2015-09-28T05:36:22.8198428Z packageFile= C:\a\d8c9303e\staging\Orchard.Web.zip
2015-09-28T05:36:22.8258420Z Get-AzureWebSite -Name **** -ErrorAction SilentlyContinue
2015-09-28T05:36:28.4361621Z Publish-AzureWebsiteProject -Name "****" -Package "C:\a\d8c9303e\staging\Orchard.Web.zip"
2015-09-28T05:36:33.8798112Z ##[error]Unable to perform the operation ("Delete File") for the specified directory ("HtmlAgilityPack.dll"). This can occur if the server administrator has not authorized this operation for the user credentials you are using.
2015-09-28T05:36:33.8818107Z ##[error] Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_INSUFFICIENT_ACCESS_TO_SITE_FOLDER.
Use the provided Orchard.proj msbuild script using the Precompiled target.

Resources