azure-functions-host: FlexConsumption Deployment AzureDevops Error

  • I am using dotnet-isolated runtime and version 8.0
  • I have deployed Flex Consumption plan and app via Bicep.
  • I am using the AzureWebJobsStorage__accountname app setting and system assigned identity which I have given Storage Blob Data Contributor access to the storage account.
  • I am using vnet integration and the subnet also has access to the storage account.
  • I am using az functionapp deployment source config-zip CLI task in AzurePipelines yml file to deploy the code to the container I am using inside the deployment settings. However, the task always fails with:
    • "ERROR: Failed to fetch host key to check for function app status".

Any ideas? I do have other app settings for things like service bus which I have given access to with the identity as above.

Please find the bicep template below. I apologise if I’ve raised this in the wrong repository.

resource flexApp 'Microsoft.Web/sites@2023-12-01' = {
  name: appName
  kind: 'functionapp,linux'
  location: location
  tags: {
    app: app
    environment: environment
  }
  properties: {
    httpsOnly: true
    serverFarmId: flexPlan.id
    virtualNetworkSubnetId: subnetId
    siteConfig: {
      appSettings: appSettings
      minTlsVersion: '1.2'
      http20Enabled: true
      publicNetworkAccess: 'Enabled'
      cors: {
        allowedOrigins: [
          corsUrl
        ]
      }
    }
    functionAppConfig: {
      deployment: {
        storage: {
          type: 'blobContainer'
          value: 'https://${storageAccountName}.blob.${az.environment().suffixes.storage}/${storageContainerName}'
          authentication: {
            type: 'SystemAssignedIdentity'
          }
        }
      }
      scaleAndConcurrency: {
        maximumInstanceCount: numOfInstances
        instanceMemoryMB: 2048
      }
      runtime: { 
        name: runtimeName
        version: netFrameworkVersion
      }
    }
  }
  identity: {
    type: 'SystemAssigned'
  }
}

In the portal I also see this Image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 15 (3 by maintainers)

Most upvoted comments

it definitely seems like there is an issue accessing storage. will share the func name in Teams DM

If you’re not comfortable sharing the app name here, feel free to provide the invocation ID, and we can look up the associated app name for you.

Hey @matthetherington, @markti - Sam here, I work on the deployment area. Is this issue only occuring in Flex Consumption and deploying via AZ CLI command?

I can take a deeper look if you can provide an app name and timestamp where you observed issues.

I have the exact same problem with user-assigned managed identity for internal storage. The deployment succeeds and code works, but the host key part fails. When looking at the function keys from Portal, it says “Error while loading host keys” (InternalServerError)