Menu Home

Install Azure Site Extensions with ARM template

Azure Site Extensions is a way to add extra functionality to an azure web app. Currently the number of extensions are rather limited, but yet there are a few interesting ones, e.g. the Visual Studio Online extensions that lets you edit your code directly in the Azure Web Site.

If you want to develop your own extensions that is also fairly easy (although it might be hard to come up with a good idea, as azure web apps already are able to do so many things). Regardless if you are interested in developing your own head over to the Kudu Github Repo and take a look at this article.

Extensions are essentially a nuget package that contains an applicationhost.xdt file, that explains how to install the extensions. Extensions are typically a small web application that is mapped into the Kudu site, via a virtual directory pointing to the location where the extension is installed. By default (and I don’t think it is possible to change it) extensions are installed in d:\Program Files (x86)\SiteExtensions\
Here’s a dir in that folder to give you an idea of what is Microsoft puts on your server without you even asking for it.
D:\Program Files (x86)\SiteExtensions>dir
Volume in drive D is Windows
Volume Serial Number is C83A-45BE

Directory of D:\Program Files (x86)\SiteExtensions

06/30/2015 10:34 PM <DIR> .
06/30/2015 10:34 PM <DIR> ..
07/31/2015 08:01 PM <DIR> ApiAppsGateway
07/21/2015 01:36 AM <DIR> AppIdentify
06/23/2015 12:11 AM <DIR> AzureJobs
05/30/2015 10:32 AM <DIR> DaaS
05/30/2015 10:13 AM <DIR> DebugSiteExtension
06/30/2015 10:34 PM <DIR> dropboxconnector
05/30/2015 10:32 AM <DIR> EMABench
06/30/2015 10:34 PM <DIR> FacebookConnector
05/30/2015 10:13 AM <DIR> httpPlatformHandler
05/30/2015 10:20 AM <DIR> iisnodedebugger
05/30/2015 10:12 AM <DIR> InetMgr
07/31/2015 08:01 PM <DIR> Kudu
05/30/2015 10:31 AM <DIR> Microsoft.Azure.AppService.ApiApps.TestBench
05/30/2015 10:31 AM <DIR> Migrate
06/24/2015 10:37 PM <DIR> MobileServicesDotNet
05/30/2015 10:31 AM <DIR> MobileServicesNode
07/31/2015 08:01 PM <DIR> Monaco
05/30/2015 10:31 AM <DIR> MSDeploy
06/30/2015 10:34 PM <DIR> SalesforceConnector
05/30/2015 10:28 AM <DIR> SecurityInsightAdmin
05/30/2015 10:28 AM <DIR> Tinfoil
06/30/2015 10:34 PM <DIR> TwitterConnector
06/30/2015 10:34 PM <DIR> YammerConnector
07/29/2015 04:58 PM <DIR> Zray54
07/29/2015 04:59 PM <DIR> Zray55
07/29/2015 04:59 PM <DIR> Zray56

All the public extensions from the extension gallery is hosted at http://www.siteextensions.net/. If you make your own site extension you can also get it hosted there as it is just a nuget feed. If you don’t want to share your extension with the world, you can also host it on a private nuget feed.

A few of the extensions are preinstalled on the server like e.g. the Monaco (Visual Studio Online) Extension, so it doesn’t show up in the feed at http://www.siteextensions.net/.

Anyways, enough about how site extensions works, what I really wanted to show with this post, was how to install them from an Azure Resource Manager (ARM) template. Behold here goes:

Here’s how the Microsoft.Web/sites resource template looks like, that installs the Monaco extension (Visual Studio Online).

{
      "apiVersion": "2014-04-01",
      "name": "[parameters('siteName')]",
      "type": "Microsoft.Web/sites",
      "location": "[parameters('siteLocation')]",
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
      ],
      "properties": {
        "name": "[parameters('siteName')]",
        "webHostingPlan": "[parameters('hostingPlanName')]"
      },
      "resources": [
        {
          "apiVersion": "2014-04-01",
          "name": "web",
          "type": "config",
          "dependsOn": [
            "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
          ],
          "properties": {
            "appSettings": [
              { "Name": "SCM_SITEEXTENSIONS_FEED_URL", "Value": "http://www.siteextensions.net/api/v2/" },
            ]
          }
        },
        {
          "apiVersion": "2014-04-01",
          "name": "Monaco",
          "type": "siteextensions",
          "dependsOn": [
            "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]",
            "[resourceId('Microsoft.Web/Sites/config', parameters('siteName'), 'web')]"
            ],
          "properties": { }
        },
      ]
    }

As you can see we specify a SCM_SITEEXTENSIONS_FEED_URL app setting, that points to the nuget feed. This is strictly not neccessary as Kudu per default uses that feed, but if you want to deploy an extension from your own feed this would be the place to put your feed url.

Categories: Software Windows Azure

Tagged as:

Simon J.K. Pedersen

Leave a Reply

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