How to read Kudu logs deploying Azure Web Services via pipeline

‘Failed to deploy web package to App Service’ in an Azure DevOps pipeline for ci/cd deployment

I am a PowerShell Engineer and in addition I sometimes work with Yaml pipelines in Azure DevOps, but I am by no means an expert.

The same goes for Azure Web Services.
I have little experience building an Azure Web App and maintaining an Azure Web App.
I did manage to deploy an Azure Web App via an Azure DevOps pipeline.

We have a DTAP deployment at my current employer. We use multiple pipelines that can deploy and maintain our products (within our team).

When deploying an Azure Web App (Swagger API) I only got an error message on the production environment.
Strange, because why didn’t it go wrong on the test and accept?
The only ‘major’ difference is that the production API has been around longer and we later moved to DTAP.

The error messages I got in a pipeline ci/cd deployment

The error messages within the pipeline tell me to get the kudu trace log.

For me, this was the first time I heard about Kudu and at the time I didn’t know what Kudu was, but for those interested, Microsoft wrote an explanation about it:

##[error]Failed to deploy web package to App Service.
##[error]To debug further please check Kudu stack trace URL : https://$XX-XXX:***
##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.

The error message within your pipeline is brief, but clear.
You can click on the Kudu link, but make sure you log in with an account that has access to the Azure Web Service.

Where I first say that the log in your pipeline is short and sweet, this does not apply to the Kudu log. What a drama, so much text in one file?


Let’s check Kudu stack trace

Fortunately, the Kudu trace is in json format.
This allows you to go through the log quite easily.

When you open the URL and copy the full text to Visual Studio Code, for example, you can easily format the code to more readable text.

You save the file as a json file and then right-click in the file and choose Format Document (or Shift + Alt + F).

How to read Kudu logs deploying Azure Web Services via pipeline
How to read Kudu logs deploying Azure Web Services via pipeline

Which will be more readable:

    "name": "2022-10-18T08-43-16_35d282_001_Startup_GET_diagnostics-runtime_0s.xml",
    "size": 318,
    "mtime": "2022-10-18T08:43:16.6845388+00:00",
    "crtime": "2022-10-18T08:43:16.6532931+00:00",
    "mime": "text/xml",
    "href": "",
    "path": "C:\\home\\LogFiles\\kudu\\trace\\2022-10-18T08-43-16_35d282_001_Startup_GET_diagnostics-runtime_0s.xml"
    "name": "2022-10-18T08-43-16_35d282_002_GET_diagnostics-runtime_200_4s.xml",
    "size": 1127,
    "mtime": "2022-10-18T08:43:20.96957+00:00",
    "crtime": "2022-10-18T08:43:16.7314079+00:00",
    "mime": "text/xml",
    "href": "",
    "path": "C:\\home\\LogFiles\\kudu\\trace\\2022-10-18T08-43-16_35d282_002_GET_diagnostics-runtime_200_4s.xml"
    "name": "2022-10-18T09-05-49_35d282_003_Shutdown_0s.xml",
    "size": 283,
    "mtime": "2022-10-18T09:05:49.2911112+00:00",
    "crtime": "2022-10-18T09:05:49.2598028+00:00",
    "mime": "text/xml",
    "href": "",
    "path": "C:\\home\\LogFiles\\kudu\\trace\\2022-10-18T09-05-49_35d282_003_Shutdown_0s.xml"

The log is sorted by time and the newest logs are at the bottom.

  • mtime: is the last modification time, which updates when you change the contents of a file.
  • crtime: is the creation time, which doesn’t update.

Source: Linux Timestamps: The Difference Between atime, mtime, ctime, and crtime

To my great surprise there are no error messages here, but again urls, this time to xml output.

It contains various reports, but you can search by time and by ‘subject’.
I have run a deployment which is done through a ZipDeploy, so looking at the name, you should be able to figure it out.

If I understand the xmls correctly, the first line is a call made to the Kudu API (of your application).
So the first line contains the URL plus the method. Below this line is each step what is done in the backend.

So, I finally found the error message bugging me, but unfortunately, my error message is still not as readable as I hoped for:

<step title="C:\PROGRA~2\SITEEX~1\NODEAP~1\296456~1.8\nodejs\build\src\Loader.js:153 ...StatusLogger.DEFAULT_STATUS, ^^^ SyntaxError: Unexpected token ... at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at module.js:669:12 at Array.forEach (native) C:\Program Files (x86)\SiteExtensions\Kudu\100.50331.6204\bin\Scripts\starter.cmd "C:\Program Files (x86)\SiteExtensions\Kudu\100.50331.6204\bin\node_modules\.bin\kuduscript.cmd" -y --no-dot-deployment -r "C:\local\Temp\zipdeploy\extracted" -o "C:\home\site\deployments\tools" --basic --sitePath "C:\local\Temp\zipdeploy\extracted" DEPLOYMENTINFO: deploymentPath = ZipDeploy. Extract zip. , deployer = VSTS_ZIP_DEPLOY, os = windows, sku = Basic, siteName = XXX, siteHostName =, deploymentStatus = Error" date="2023-05-30T12:33:19.384"/>

But hey! Stackoverflow for the win!

Azure web app service deployment failure saying “SyntaxError: Unexpected token” after updating VS Code – Stack Overflow

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work as a PowerShell DevOps Engineer. In my spare time I write about interesting stuff that I encounter during my work.

Leave a Reply

Your email address will not be published. Required fields are marked *