azureazure-functionsazure-resource-managerazure-bicep

.NET version not set in azure function settings - bicep


I have this bicep code

resource azfun 'Microsoft.Web/sites@2022-09-01' = {
  name: 'functionName'
  location: location
  kind: 'functionapp'
  properties: {
    serverFarmId: appServicePlann.id
    siteConfig: {
      alwaysOn: true
      netFrameworkVersion: 'v8.0'
      appSettings: [
        {
          name: 'FUNCTIONS_WORKER_RUNTIME'
          value: 'dotnet-isolated'
        }
        {
          name: 'FUNCTIONS_EXTENSION_VERSION'
          value: '~4'
        }
      ]
    }
    httpsOnly: true
  }
  identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
      '${userManagedIdentity.id}': {}
    }
  }
}

But the .NET version is not set when it's deployed (expecting .NET 8 Isolated) enter image description here

The runtime version is also not properly set to 4

enter image description here


Solution

  • Using a newer api version (2024-04-01) with the same template worked for me:

    param location string = resourceGroup().location
    param appServicePlanName string = 'thomastest-001-asp'
    param functionName string = 'thomastest-001-func'
    
    resource appServicePlan 'Microsoft.Web/serverfarms@2024-04-01' existing = {
      name: appServicePlanName
    }
    
    resource azfun 'Microsoft.Web/sites@2024-04-01' = {
      name: functionName
      location: location
      kind: 'functionapp'
      properties: {
        serverFarmId: appServicePlan.id
        siteConfig: {
          alwaysOn: true
          netFrameworkVersion: 'v8.0'
          appSettings: [
            {
              name: 'FUNCTIONS_WORKER_RUNTIME'
              value: 'dotnet-isolated'
            }
            {
              name: 'FUNCTIONS_EXTENSION_VERSION'
              value: '~4'
            }
          ]
        }
        httpsOnly: true
      }
    }
    

    Runtime version: function app runtime version

    .NET Version: function app .NET version