Sep 282017
 
Azure App Service - Web App

While trying to figure out a problem I had when using an ARM template to deploy a web app to Azure, I found a nice debug log that contains the full steps that the web app makes to install site extensions.

My problem is that the deployment fails while installing the Application Insights site extension. I haven’t found the solution yet, so if you have any tips, please feel free to reach out to me.
Update: I found the problem, and also a solution.

The log files are located in the site’s “/LogFiles/kudu/trace” folder, which can be accessed via the Kudu console or over FTP.

They contain XML with details about the operations that are performed for site extension installation.

For me, it expanded a lot further on this message:

{
"status": "Canceled",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Canceled'."
}
}

That was not really helpful.

One log file in the “trace” folder had this content:

<step title="BackgroundTrace" date="2017-09-28T15:31:10.487" instance="8bedf0" url="/api/siteextensions/Microsoft.ApplicationInsights.AzureWebSites" method="PUT" Connection="Keep-Alive" Accept-Encoding="gzip,deflate" Accept-Language="en-US" Expect="100-continue" Host="dev-cfd-prddatasite-eu-n-wdx-wa.scm.azurewebsites.net" Referer="https://management.azure.com/subscriptions/a1233ec7-5bd3-4d78-9138-b2e43ec23d49/resourcegroups/Development/providers/Microsoft.Web/sites/dev-cfd-prddatasite-eu-n-wdx-wa/siteextensions/Microsoft.ApplicationInsights.AzureWebSites?api-version=2015-08-01" User-Agent="azure-resource-manager/2.0" x-ms-client-request-id="f38f10d2-afd9-4e6d-a590-62e3a5f62a30" x-ms-client-location="westeurope" x-ms-arm-request-tracking-id="f9fb56ba-eb6c-47d3-8d61-6cf49f003508" x-ms-correlation-request-id="168a58e0-2565-477b-864a-a8f050e24a89" x-ms-routing-request-id="NORTHEUROPE:20170928T153104Z:f9fb56ba-eb6c-47d3-8d61-6cf49f003508" x-ms-client-ip-address="213.83.141.204" x-ms-client-audience="https://management.core.windows.net/" x-ms-client-scope="user_impersonation" x-ms-client-acr="1" x-ms-client-app-id="1950a258-227b-4e31-a9cf-717495945fc2" x-ms-client-app-id-acr="0" x-ms-client-tenant-id="6d473ebc-7aec-417e-8d95-dbd36528bb2b" x-ms-client-issuer="https://sts.windows.net/6d473ebc-7aec-417e-8d95-dbd36528bb2b/" x-ms-client-object-id="b552e457-e64f-4726-a2e5-7e241ba9b0ce" x-ms-client-principal-id="10037FFE99CE3588" x-ms-client-principal-name="RASW@widex.com" x-ms-client-authorization-source="RoleBased" x-ms-client-identity-provider="" x-ms-client-authentication-methods="pwd, mfa" x-ms-from-geomaster="true" x-ms-via-extensions-route="true" x-ms-geo-location="North Europe" x-ms-version="20140301" X-WAWS-Unencoded-URL="/api/siteextensions/Microsoft.ApplicationInsights.AzureWebSites?api-version=2015-08-01" X-ARR-LOG-ID="feb97fde-7158-4422-bae8-8bf66ebaac21" X-SITE-DEPLOYMENT-ID="dev-cfd-prddatasite-eu-n-wdx-wa" WAS-DEFAULT-HOSTNAME="dev-cfd-prddatasite-eu-n-wdx-wa.scm.azurewebsites.net" X-Forwarded-Proto="https" >
  <step title="Background thread started for Microsoft.ApplicationInsights.AzureWebSites installation" date="2017-09-28T15:31:10.503" >
    <step title="Installing &apos;Microsoft.ApplicationInsights.AzureWebSites&apos; version &apos;&apos; from &apos;&apos;" date="2017-09-28T15:31:10.519" >
      <step title="Version is null, search latest package by id: Microsoft.ApplicationInsights.AzureWebSites, will not search for unlisted package." date="2017-09-28T15:31:14.455" /><!-- duration: 217ms -->
      <step title="Install package: Microsoft.ApplicationInsights.AzureWebSites." date="2017-09-28T15:31:14.688" >
        <step title="Download site extension: Microsoft.ApplicationInsights.AzureWebSites.2.4.3" date="2017-09-28T15:31:14.704" /><!-- duration: 11466ms -->
/><!-- duration: 11497ms -->
      <step title="Error occurred" date="2017-09-28T15:31:26.185" type="error" text="Thread was being aborted." stackTrace="
 at Microsoft.Win32.Win32Native.SetEndOfFile(SafeFileHandle hFile)
 at System.IO.FileStream.SetLengthCore(Int64 value)
 at System.IO.FileStream.SetLength(Int64 value)
 at Kudu.Core.SiteExtensions.FeedExtensions.&lt;DownloadPackageToFolder&gt;d__4.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Kudu.Core.SiteExtensions.SiteExtensionManager.&lt;InstallExtension&gt;d__26.MoveNext()" />
<!-- duration: 47ms -->
    </step><!-- duration: 15776ms -->

While the XML is hard to read, it is a lot more helpful, and I hope that it leads me to finding the problem.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)