Getting build failure while deploying azure function

101 Views Asked by At

While trying to deploy a azure function from vs code getting build failure. function is tested and working fine in local and giving output as expected. pip install requirments.txt command is also passed.

enter image description here

1

There are 1 best solutions below

0
Pravallika KV On

I followed below steps to deploy Python Azure Function to Azure Function App.

  • Created a Python Azure Function with version 3.11 locally.
  • Add setting "AzureWebJobsFeatureFlags": "EnableWorkerIndexing" & "AzureWebJobsStorage": "UseDevelopmentStorage=true" in local.settings.json:

local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
  }
}
  • Created a Function App with Python as runtime stack (version 3.11) in Azure Portal.

Configuration:

enter image description here

  • Deployed the function app to Azure using Visual Studio Code successfully:

enter image description here

  • If the issue still persists, you can try deploying with Azure CLI.

    • Make sure you have installed Azure function core tools.
    • If not, install with the command npm i -g azure-functions-core-tools --unsafe-perm true

enter image description here

  • Use the below command to deploy the functionapp to Azure: func azure functionapp publish <functionapp_name> --build remote.

enter image description here

  • Able to deploy successfully:

enter image description here