4

I'm configuring a api app in azure with bicep. This is a dotnet core 3.1 app. For netFrameworkVersion i provide 'v3.1', this however doesn't work. The deployment of the Bicep template does work, but my application does not. The value of .NET version is empty in the portal. enter image description here

When i manually change the version in the portal, and do an export of my app, the returned ARM template is sets netFrameworkVersion to 'v4.0'. I am very confused, what is happening here? I can't seem to find any documentation about this.
enter image description here

enter image description here

Thomas
  • 24,234
  • 6
  • 81
  • 125
Amateur
  • 177
  • 1
  • 9

4 Answers4

8

You need to specify the CURRENT_STACK metadata and the netFrameworkVersion property inside the siteConfig section:

resource webapp 'Microsoft.Web/sites@2018-11-01' = {
  ...
  properties: {
    ...
    siteConfig: {
      ...
      netFrameworkVersion: 'v6.0'
      metadata: [
        {
          name: 'CURRENT_STACK'
          value: 'dotnet'
        }
      ]
      ...
    }
    ...
  }
}
Thomas
  • 24,234
  • 6
  • 81
  • 125
  • Hi, thx for your help. Do you know where i can find documentation about this metadata parameters? there does not seem to be any on the official web/sites docs https://learn.microsoft.com/en-us/azure/templates/microsoft.web/2018-11-01/sites?tabs=bicep . – Amateur Feb 14 '22 at 16:23
  • Doesnt seems to be well documented but this sample from MS doc use that: https://learn.microsoft.com/en-us/azure/azure-monitor/app/resource-manager-web-app – Thomas Feb 14 '22 at 16:46
  • 1
    Observation: for .NET 6, the ARM template generated by Azure Portal has `CURRENT_STACK=dotnet`, and no longer `CURRENT_STACK=dotnetcore`, so I guess that would be the correct value for modern .NET versions. – Paweł Bulwan Sep 29 '22 at 11:14
0

Microsoft changed this with newer API versions, it now uses the property "linuxFxVersion" to set this:

resource webapp 'Microsoft.Web/sites@2020-12-01' = {
...
   properties: {
     ...
     siteConfig: {
        ...
        linuxFxVersion: 'DOTNETCORE|6.0'
     }
   }
}

0

For me I had to set the netFrameworkVersion in the siteConfig section:

resource functionapp 'Microsoft.Web/sites@2022-03-01' = {
...
   properties: {
     ...
     siteConfig: {
        ...
        netFrameworkVersion: '6.0'
     }
   }
}

Mr-DC
  • 799
  • 5
  • 14
  • 25
0

As of 21 April 2023 the following worked for me. metadata within siteConfig was displayed as invalid, but adding metadata as a separate config resource worked:

resource webApplication 'Microsoft.Web/sites@2022-03-01' = {
  name: 'my-app-name'
  ...
  properties: {
    ...
    siteConfig: {
      netFrameworkVersion: 'v6.0'
    }
  }
  resource meta 'config@2022-03-01' = {
    name: 'metadata'
    kind: 'string'
    properties: {
      CURRENT_STACK: 'dotnet'
    }
  }
}
germankiwi
  • 1,102
  • 10
  • 11