quervernetzt
quervernetzt

Reputation: 11621

Python Azure Function on Premium Plan: Publishing / deployment of functions fails…

I encountered multiple issues regarding the publishing / deployment of functions when using Python Azure Functions running on Linux and Premium Plan. Following are options what can be done in cases where it fails or it is successful but the function (on Azure) does not reflect what should have been published / deployed.

The following options may also work for non-Linux / non-Python / non-Premium Plan Function (Apps).

Upvotes: 0

Views: 700

Answers (1)

quervernetzt
quervernetzt

Reputation: 11621

  • Wait some minutes after the publishing so that the Function (App) reflects the update

  • Restart the Function App

  • Make sure that the following AppSettings are set under "Configuration" (please adjust to your current context)

[ 
  {
    "name": "AzureWebJobsStorage",
    "value": "<KeyVault reference to storage account connection string>",
    "slotSetting": false
  },
  {
    "name": "ENABLE_ORYX_BUILD",
    "value": "true",
    "slotSetting": false
  },
  {
    "name": "FUNCTIONS_EXTENSION_VERSION",
    "value": "~3",
    "slotSetting": false
  },
  {
    "name": "FUNCTIONS_WORKER_RUNTIME",
    "value": "python",
    "slotSetting": false
  },
  {
    "name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
    "value": "true",
    "slotSetting": false
  },
  {
    "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
    "value": "<storage account connection string>",
    "slotSetting": false
  },
  {
    "name": "WEBSITE_CONTENTSHARE",
    "value": "<func app name>",
    "slotSetting": false
  }
]
  • When using Azure DevOps Pipelines use the standard Azure Function task (https://github.com/Microsoft/azure-pipelines-tasks/blob/master/Tasks/AzureFunctionAppV1/README.md) to publish the function respectively set the AppSettings.

    • This task also works for Python even if it does not explicitly provide the option under "Runtime Stack" (just leave it empty).
  • Make sure to publish the correct files (if you publish via ZipDeploy the zip folder should contain host.json at its root)

    • You can check if the correct files haven been published via checking the wwwroot folder via the Azure Portal -> Function App -> Development Tools -> SSH
cd /home/site/wwwroot
dir
  • Check the deployment logs

    • Either via the link displayed as output during the deployment
      • Should look like "https://func-app-name.net/api/deployments/someid/log"
      • Via Development Tools -> Advanced Tools
  • If the steps so far did not help it can help to SSH to the host via the portal (Development Tools -> SSH) and to delete

# The deployments folder (and then republish)
cd /home/site
rm -r deployments

# The wwwroot folder (and then republish)
cd /home/site
rm -r wwwroot
  • Delete the Function App resource and redeploy it

Upvotes: 1

Related Questions