5

In ARM template for Azure Web App, how do you specify the stack settings for the app (.NET, .NET Core, PHP, ...)? I cannot see any field for it.

Thank you

1
  • Hi! Would you explain the problem please? Maybe could you paste code that you have.
    – sergibarca
    Dec 2, 2019 at 14:59

3 Answers 3

11

When you create azure webapp on portal, choose Running stack as .Net Core 3.0(Current).

Then click Review+Create > Download a template for automation. You will see the ARM template which contain metadata attribute and the current stack value is dotnetcore.

enter image description here

{
    "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
    }
}
3
  • for .Net Core: "CURRENT_STACK": { "value": "dotnetcore" } Apr 7, 2020 at 15:02
  • As a small note: This solution does only work for NEW WebApps... if you want to CHANGE an existing WebApp from .NEt to .NEtCore you also must clear "netFrameworkVersion". Otherwise the stack is not changed. Oct 2, 2020 at 5:07
  • Observation: for .NET 6, the ARM template generated by Azure Portal has CURRENT_STACK=dotnet, and not CURRENT_STACK=dotnetcore as in .NET Core 3.x. Sep 29, 2022 at 11:15
2

Adding to Joey's answer, the value for CURRENT_STACK for .NET Core would be dotnetcore.

{
            "type": "Microsoft.Web/sites",
            "apiVersion": "2018-11-01",
            "name": "<name>",
            "location": "[resourceGroup().location]",
            "kind": "app",
            "properties": {
                "enabled": true,
                "siteConfig": {
                    "metadata": [
                        {
                            "name": "CURRENT_STACK",
                            "value": "dotnetcore"
                        }
                    ]
                }
            }
        }
1

As a small note: This proposed solution does only work for NEW WebApps... if you want to CHANGE an existing WebApp from .Net4.x to .NetCore you also must clear "netFrameworkVersion". Otherwise the stack is not changed.

So correct would be:

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

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.