6

I've set-up an App Service using the following ARM template snippet:

{
  "name": "[variables('webBackEnd')]",
  "type": "Microsoft.Web/sites",
  "location": "[parameters('location')]",
  "apiVersion": "2015-08-01",
  "dependsOn": [
    "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
  ],
  "tags": {
    "[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName')))]": "Resource",
    "displayName": "BackendWebApp"
  },
  "properties": {
    "name": "[variables('webBackEnd')]",
    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
  }
},

This will deploy an App Service. However, by default, it will be setup to use the .Net Framework. Below is a view from my Azure Portal:

App Service configured to run .Net Framework

In order to run my ASP.Net Core-based web server, I have to manually switch the Stack Settings from ".Net" to ".Net Core". It's a trivial thing to do, but I'd much rather configure it correctly through the ARM template. I searched Microsoft's docs but was unable to find the correct property. How does one go about to do this?

2 Answers 2

18

here's how an example web app looks when created from the portal:

{
    "apiVersion": "2018-02-01",
    "name": "[parameters('name')]",
    "type": "Microsoft.Web/sites",
    "location": "[parameters('location')]",
    "properties": {
        "name": "[parameters('name')]",
        "siteConfig": {
            "appSettings": [],
            "metadata": [
                {
                    "name": "CURRENT_STACK",
                    "value": "[parameters('currentStack')]"
                }
            ]
        },
        // redacted some values
    }
},

and the current stack value is dotnetcore

9
  • Very interesting. When I create an App Service in the Portal, the runtime will be preset to ".Net Core". But I don't see any difference in the exported ARM template. Moreover, the "metadata" property which seems to control the stack setting is not documented in Microsoft.Web sites template reference
    – djf
    Sep 18, 2019 at 7:45
  • 1
    template reference is garbage, unfortunately
    – 4c74356b41
    Sep 18, 2019 at 7:56
  • 1
    I verified that your solution works as intended. Thanks!
    – djf
    Sep 18, 2019 at 8:23
  • 4
    Given that the reference is garbage, and that the portal is not generating the CURRENT_STACK metadata thing, how on earth did you find out?
    – Esben Bach
    Nov 7, 2019 at 13:45
  • 1
    sorry, I answer hundreds of questions here, I dont really remember. i guess what it says. start creating the webapp and look at the template that gets used before you hit create? @AlexanderSchmidt
    – 4c74356b41
    Apr 16, 2020 at 14:28
1

The accepted answer didn't work for me. I began my own investigation and finished with this code, which works in my case.

"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[parameters('site_name')]",
"location": "[resourceGroup().location]",
.........................................

"resources": [
 {
    "name": "metadata",
    "type": "config",
    "apiVersion": "2018-11-01",
    "dependsOn": [
        "[resourceId('Microsoft.Web/sites', parameters('site_name'))]"
    ],
    "tags": {
    },
    "properties": {
        "CURRENT_STACK": "dotnetcore"
    }
 }
]
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.