.netazure-functionsazure-functions-isolateddotnet-isolated

Failed to sync triggers for function app 'funcsintest03'. Error: BadRequest - Encountered an error (BadGateway) from host runtime. (CODE: 400)


I have an Linux Azure function with runtimeStack as 'DOTNET-ISOLATED|9.0'. I am using consumption plane and AzureFunctionApp@2 Azure DevOps pipeline task to deploy my code from Azure DevOps.

      - task: AzureFunctionApp@2 # Add this at the end of your file
        inputs:
          azureSubscription: ${{ parameters.azureSubscriptionServiceConnection }}
          appType: functionAppLinux # This specifies a Linux-based function app
          #isFlexConsumption: true # Uncomment this line if you are deploying to a Flex Consumption app
          appName: ${{ parameters.functionAppName }}
          package: $(Build.SourcesDirectory)/bin/*.zip
          deploymentMethod: "runFromPackage" # 'auto' | 'zipDeploy' | 'runFromPackage'. Required. Deployment method. Default: auto.
          #Uncomment the next lines to deploy to a deployment slot
          #Note that deployment slots is not supported for Linux Dynamic SKU
          #deployToSlotOrASE: true
          #resourceGroupName: '<RESOURCE_GROUP>'
          #slotName: '<SLOT_NAME>'
          runtimeStack: 'DOTNET-ISOLATED|9.0'

I am always getting the error ##[error]Error: Failed to sync triggers for function app 'funcsintest03'. Error: BadRequest - Encountered an error (BadGateway) from host runtime. (CODE: 400)


Solution

  • Tried a few settings in my ARM template and finally this doc helped. Added below settings to my ARM template for the functionapp and that fixed that issue.

     {
       "name": "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED",
       "value": "1"
     }
    
     {
       "name": "linuxFxVersion",
       "value": "DOTNET-ISOLATED|9.0"
     }
    

    Below is my full ARM template for the Linux functionapp.

    {
                "type": "Microsoft.Web/sites",
                "apiVersion": "2024-04-01",
                "name": "[parameters('funcName')]",
                "location": "[parameters('funcAppLocation')]",
                "kind": "functionapp,linux",
                "identity": {
                    "type": "SystemAssigned"
                },
                "properties": {
                    "reserved": true,
                    "alwaysOn": true,
                    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('funcAppServerFarmName'))]",
                    "linuxFxVersion": "DOTNET-ISOLATED|9.0",
                    "siteConfig": {
                        "linuxFxVersion": "DOTNET-ISOLATED|9.0",
                        "appSettings": [
                            {
                                "name": "FUNCTIONS_EXTENSION_VERSION",
                                "value": "~4"
                            },
                            {
                                "name": "FUNCTIONS_WORKER_RUNTIME",
                                "value": "dotnet-isolated"
                            },
                            {
                                "name": "linuxFxVersion",
                                "value": "DOTNET-ISOLATED|9.0"
                            },
                            {
                                "name": "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED",
                                "value": "1"
                            }
                        ],
                        "minTlsVersion": "1.3"
                    },
                    "runtime": {
                        "name": "dotnet-isolated"
                    },
                    "httpsOnly": true
                },
                "dependsOn": [
                    "[resourceId('Microsoft.Insights/components', parameters('insightsComponentName'))]",
                    "[resourceId('Microsoft.Web/serverfarms', parameters('funcAppServerFarmName'))]",
                    "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageName'))]"
                ]
            }