MindingData
MindingData

Reputation: 12508

Deployment of Azure Function App Fails with "Kudu"

Whie deploying an Azure Function App via Azure Devops. We receive the following error :

Starting: AzureFunctionApp
==============================================================================
Task         : Azure Functions Deploy
Description  : Update a function app with .NET, Python, JavaScript, PowerShell, Java based web applications
Version      : 2.225.1
Author       : Microsoft Corporation
Help         : https://aka.ms/azurefunctiontroubleshooting
==============================================================================
Got service connection details for Azure App Service:'***'
Updating App Service Application settings. Data: {"WEBSITES_ENABLE_APP_SERVICE_STORAGE":"true","WEBSITE_RUN_FROM_PACKAGE":"1"}
App Service Application settings are already present.
Package deployment using ZIP Deploy initiated.
##[error]Failed to deploy web package to App Service.
##[warning]Can't find loc string for key: KuduStackTraceURL

The error only appears after timing out after approx 45 minutes of deployment. Other Functions are deployed fine, it's just this one that seems to have an issue.

Upvotes: 0

Views: 1243

Answers (1)

MindingData
MindingData

Reputation: 12508

I saw so many answers for this particular error but none that really hit the spot.

What led me down the path was that the "Storage" of the account may be wrong. So the first thing to check is what you have the Environment Variable of WEBSITE_CONTENTAZUREFILECONNECTIONSTRING set to. This should be a pointer to a storage account.

If this connection string is wrong or broken, fix this.

Next, if this is a KeyVault reference (Or even if it isn't), you may have a setting of

WEBSITE_SKIP_CONTENTSHARE_VALIDATION: '1'

When this is set, this skips the auto creation of the "FileShare" in Azure Storage. When you are using a KeyVault reference, this is required, but essentially with this turned on it won't auto create the folder required for your function app.

If this is set to 1, then you need to manually create the fileshare.

In my case, with Bicep (Although you can create this manually)

resource fileServices 'Microsoft.Storage/storageAccounts/fileServices/shares@2023-01-01'= {
  name: '${storageAccountName}/default/${functionAppName}'
}

If you are unsure of where this fileshare is created or the naming, create a new azure function via the portal, against the same storage account, and check the folder it auto creates.

After creating this fileshare manually, I am able to deploy my Function App.

Upvotes: 0

Related Questions