skip to Main Content

We had a Azure Function with Timer Trigger which was develop using function version 3.0 and .NET 3.1. This function is running on Windows App Service Plan on Azure. So, I have upgraded it to function version 4.0 and .NET 6.0 using below steps:

Upgrade your local project
The following changes are required in the .csproj XML project file:

  1. Change the value of PropertyGroup.TargetFramework to net6.0.
  2. Change the value of PropertyGroup.AzureFunctionsVersion to v4.
  3. Replace the existing ItemGroup.PackageReference list with the following ItemGroup:
    Image
    After you make these changes, your updated project should look like the following example:
    Image
  4. Upgrade the local.settings.json file
    Image
  5. Run the function app locally and verify the functionality.

Upgrade your function app in Azure

  1. Run below command to set the FUNCTIONS_EXTENSION_VERSION application setting to ~4 on your function app in Azure.

    az functionapp config appsettings set –settings FUNCTIONS_EXTENSION_VERSION=~4 -g <RESOURCE_GROUP_NAME> -n <APP_NAME>

  2. Change the .NET version of the function app. If you’re function app is hosted on Windows, run below command.

    az functionapp config set –net-framework-version v6.0 -g <RESOURCE_GROUP_NAME> -n <APP_NAME>

However, I cannot test or see the function.json file from Azure Portal.

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I was able to find the reason for the issue by running "Diagnose and solve problems" from Azure portal.

    The issue was related to the function name. My function name length was more than 32 characters long. By default, the Host ID is auto-generated from the Function App name, by taking the first 32 characters. If you have multiple Function Apps sharing a single storage account and they're each using the same Host ID (generated or explicit), that can result in a Host ID collision. For example, if you have multiple apps with names longer than 32 characters their computed IDs may be the same. Consider two Function Apps with names myfunctionappwithareallylongname-eastus-production and

    myfunctionappwithareallylongname-westus-production

    that are sharing the same storage account. The first 32 characters of these names are the same, resulting in the same Host ID myfunctionappwithareallylongname being generated for each(Please refer https://github.com/Azure/azure-functions-host/wiki/Host-IDs#host-id-collisions for more information).

    So, to solve the issue, I just rename the function name on Azure.


  2. I have taken the .NET 3.1 Azure Function Project with Timer Trigger in the VS 2022 IDE:

    enter image description here

    Published the .NET Core 3.1 Azure Functions Project to Azure Function App in the Azure Portal and then changed the FUNCTIONS_EXTENSION_VERSION to 4 using Azure CLI Command by following this MS Doc:

    enter image description here

    enter image description here

    Running locally after migration to V4-.NET 6:

    enter image description here

    Then, deployed the migrated project to the Azure Function App and tested as shown below:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search