KUDU Site Extensions

In part 2 of the article we understand the various way that we can extend KUDU. In this article we will see how to write custom site Extension.

Under Site Extensions Gallery so many extensions are provides. Some of them are shown below

KuduPart_3

Steps to follow for creating Custom Site Extension

  • Create Site Extensions under Root Folder.
  • Create folder under this with meaningful name
  • Create the below 2 files
  • xdt : How to transform application host file
  • aspx (Write your business logic here) or mvc/asp.net project with business logic.
  • Publish the changes to Azure website
  • Now browse the site {website}.scm.azurewebsites.net/{extensionname}

 

What is applicationHost.xdt

ApplicationHost.config is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server. This is available under system32\inetsrv\config folder. The way to change the applicationHost.config file in an azure web application is XDT(XML Document Transforms).

Suppose I want to reduce the connection time out of azure web application

KuduPart_3.1

Custom Site Extension Scenarios

Compute size of directories (Application/IIS/Detailed Error) under logFiles Folder. For this we need to write a custom site extension.

Recycling the IIS and Delete the temporary asp.net files

Pushing the Logs to Azure EventHubs for various BI Operations.

Conclusion

Site extensions can be made easily with KUDU Framework and we can add more tools to the existing environment. applicationHost.xdt is the file which will help us to modify the global webserver settings and as well as transforming/customizing the existing azure websites.