5

I'm updating an existing web app to .NET 5. There is an ARM template that describes the web app configuration.

In the ARM template I have added

  "netFrameworkVersion": "v5.0",

inside the Microsoft.Web/sites/config properties object.

The ARM template deployment succeeds, but the web app configuration is not changed from .NET Core 3.1 to .NET 5.

Oddly, when I look at the Azure Resource manager, it does contain the net netFrameworkVersion value.

This configuration is what I'm trying to change to .NET 5: Web app configuration showing .NET Core 3.1, 2.1

Am I missing a setting, or is it not possible to update the .NET version using an ARM template?

2 Answers 2

5

The answer for me was setting the property netFrameworkVersion to v6.0. No other change was necessary.

enter image description here

This is the partial ARM template, the section changed:

{
  "name": "[parameters('webSiteName')]",
  "type": "Microsoft.Web/sites",
  "apiVersion": "2019-08-01",
  "location": "[parameters('location')]",
  "tags": {
    "[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty"
  },
  "dependsOn": [
    "[variables('hostingPlanName')]",
    "[variables('appInsightsName')]"
  ],
  "properties": {
    "name": "[parameters('webSiteName')]",
    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
    "siteConfig": {
      "appSettings": [
        {
          "name": "APPINSIGHTS_INSTRUMENTATIONKEY",
          "value": "[reference(resourceId('Microsoft.Insights/components/', variables('appInsightsName')), '2020-02-02-preview').InstrumentationKey]"
        },
        {
          "name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
          "value": "[reference(resourceId('Microsoft.Insights/components', variables('appInsightsName')), '2020-02-02-preview').ConnectionString]"
        }
      ],
      "connectionStrings": [
        {
          "name": "DefaultConnection",
          "connectionString": "[concat('Data Source=tcp:', reference(resourceId('Microsoft.Sql/servers/', variables('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters('databaseUserLogin'), '@', reference(resourceId('Microsoft.Sql/servers/', variables('sqlServerName'))).fullyQualifiedDomainName, ';Password=', parameters('databaseUserPassword'), ';')]",
          "type": "SQLAzure"
        }
      ],
      "ftpsState": "FtpsOnly",
      "netFrameworkVersion": "v6.0"
    },
    "httpsOnly": true
  }
}

You can find the full resource and ARM template at: https://github.com/feliperomero3/MoneySmart/blob/e2210eb6217eb6e06a299870acaf115d2e50c6a5/AzureResourceGroup/azuredeploy.json

Sign up to request clarification or add additional context in comments.

Comments

1

Except for the netFrameworkVersion you need to change, also you need to add another resource to the resources in your template, just add it like below, it works fine on my side.

Note: It is for the web app whose OS is Windows.

    {
        "type": "Microsoft.Web/sites/config",
        "apiVersion": "2018-11-01",
        "name": "[concat(parameters('webapp_name'), '/metadata')]",
        "location": "Central US",
        "dependsOn": [
            "[resourceId('Microsoft.Web/sites', parameters('webapp_name'))]"
        ],
        "properties": {
            "CURRENT_STACK": "dotnet"
        }
    }

My complete sample:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "webapp_name": {
            "defaultValue": "joyweb11",
            "type": "String"
        },
        "serviceplan_resourceid": {
            "defaultValue": "/subscriptions/xxxxx/resourceGroups/xxxx/providers/Microsoft.Web/serverfarms/joyplan",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Web/sites",
            "apiVersion": "2018-11-01",
            "name": "[parameters('webapp_name')]",
            "location": "Central US",
            "tags": {},
            "kind": "app",
            "properties": {
                "enabled": true,
                "hostNameSslStates": [
                    {
                        "name": "[concat(parameters('webapp_name'), '.azurewebsites.net')]",
                        "sslState": "Disabled",
                        "hostType": "Standard"
                    },
                    {
                        "name": "[concat(parameters('webapp_name'), '.scm.azurewebsites.net')]",
                        "sslState": "Disabled",
                        "hostType": "Repository"
                    }
                ],
                "serverFarmId": "[parameters('serviceplan_resourceid')]",
                "reserved": false,
                "isXenon": false,
                "hyperV": false,
                "siteConfig": {},
                "scmSiteAlsoStopped": false,
                "clientAffinityEnabled": true,
                "clientCertEnabled": false,
                "hostNamesDisabled": false,
                "containerSize": 0,
                "dailyMemoryTimeQuota": 0,
                "httpsOnly": false,
                "redundancyMode": "None"
            }
        },
        {
            "type": "Microsoft.Web/sites/config",
            "apiVersion": "2018-11-01",
            "name": "[concat(parameters('webapp_name'), '/web')]",
            "location": "Central US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('webapp_name'))]"
            ],
            "tags": {
                
            },
            "properties": {
                "numberOfWorkers": 1,
                "defaultDocuments": [
                    "Default.htm",
                    "Default.html",
                    "Default.asp",
                    "index.htm",
                    "index.html",
                    "iisstart.htm",
                    "default.aspx",
                    "index.php",
                    "hostingstart.html"
                ],
                "netFrameworkVersion": "v5.0",
                "requestTracingEnabled": false,
                "remoteDebuggingEnabled": false,
                "remoteDebuggingVersion": "VS2019",
                "httpLoggingEnabled": false,
                "logsDirectorySizeLimit": 35,
                "detailedErrorLoggingEnabled": false,
                "publishingUsername": "$joyweb11",
                "azureStorageAccounts": {},
                "scmType": "None",
                "use32BitWorkerProcess": true,
                "webSocketsEnabled": false,
                "alwaysOn": true,
                "managedPipelineMode": "Integrated",
                "virtualApplications": [
                    {
                        "virtualPath": "/",
                        "physicalPath": "site\\wwwroot",
                        "preloadEnabled": true
                    }
                ],
                "loadBalancing": "LeastRequests",
                "experiments": {
                    "rampUpRules": []
                },
                "autoHealEnabled": false,
                "localMySqlEnabled": false,
                "ipSecurityRestrictions": [
                    {
                        "ipAddress": "Any",
                        "action": "Allow",
                        "priority": 1,
                        "name": "Allow all",
                        "description": "Allow all access"
                    }
                ],
                "scmIpSecurityRestrictions": [
                    {
                        "ipAddress": "Any",
                        "action": "Allow",
                        "priority": 1,
                        "name": "Allow all",
                        "description": "Allow all access"
                    }
                ],
                "scmIpSecurityRestrictionsUseMain": false,
                "http20Enabled": false,
                "minTlsVersion": "1.2",
                "ftpsState": "AllAllowed",
                "reservedInstanceCount": 0
            }
        },
        {
            "type": "Microsoft.Web/sites/hostNameBindings",
            "apiVersion": "2018-11-01",
            "name": "[concat(parameters('webapp_name'), '/', parameters('webapp_name'), '.azurewebsites.net')]",
            "location": "Central US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('webapp_name'))]"
            ],
            "properties": {
                "siteName": "[parameters('webapp_name')]",
                "hostNameType": "Verified"
            }
        },
        {
            "type": "Microsoft.Web/sites/config",
            "apiVersion": "2018-11-01",
            "name": "[concat(parameters('webapp_name'), '/metadata')]",
            "location": "Central US",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('webapp_name'))]"
            ],
            "properties": {
                "CURRENT_STACK": "dotnet"
            }
        }
    ]
}

enter image description here

enter image description here

2 Comments

Thank you. I ended up adding the metadata property to the siteConfig property I already had instead of creating a new resource: ```` "siteConfig": { "netFrameworkVersion": "v5.0", "use32BitWorkerProcess": false, "alwaysOn": true, "webSocketsEnabled": true, "metadata": [ { "name": "CURRENT_STACK", "value": "dotnet" } ] } ````
@RasmusW Yeah, they are both ok, anyway the metadata is needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.