Azure (Python) Function Code Deployment --- Zip Deployments' trigger does not work

Timbus, Calin 15 Reputation points
2023-04-25T07:51:26.4533333+00:00

I have an Azure Linux Function App that I am deploying using TerraForm. I have Linux Function + Consumption Plan. The .zip function contains 3 .py scripts, one init.py and function.json. The code deployment goes well, but the triggering does not work (the function is an Azure Storage Blob Trigger that fires when a specific file is uploaded on the blob container). If I use the Azure Function Core Tools, the deployment goes well and the triggering works (I open the log streams/monitor and I see the function is constantly polling for objects inside that container). If I use the CLI or TerraForm to upload the code, the triggering does not work. Here is my code for the function_app:

resource "azurerm_linux_function_app" "blurring_fn_app" {
  name                        = "blurring-app-new4"
  location                    = var.location
  resource_group_name         = var.resource_group
  storage_account_name        = var.storage_account
  storage_account_access_key  = data.azurerm_key_vault_secret.sensestgaccountkey.value
  service_plan_id             = azurerm_service_plan.blurring_app_service_plan.id
  functions_extension_version = "~4"
  app_settings = {
    "APPINSIGHTS_INSTRUMENTATIONKEY" = "${data.azurerm_key_vault_secret.appinsightskey.value}"
    "AzureWebJobsStorage"            = "${data.azurerm_key_vault_secret.azure_web_jobs_storage.value}" 
    "ENABLE_ORYX_BUILD"              = true
    "SCM_DO_BUILD_DURING_DEPLOYMENT" = true
  }
  site_config {
    application_insights_key               = data.azurerm_key_vault_secret.appinsightskey.value
    application_insights_connection_string = data.azurerm_key_vault_secret.appinsightsconnstr.value
    application_stack {
      python_version = "3.9"
    }
  }
}

What I already tried: I tried using the func CLI deployment, which works for the uploading, but the function is not triggered. I tried using the "WEBSITE_RUN_FROM_PACKAGE"= azurerm_storage_blob.storage_blob_function.url (.zip of scripts uploaded to an Azure Storage Blob, this must be an URL in case of Linux apps + Consumption Plan), which works as well for the uploading, but the function is not triggered. I also tried using zip_deploy_file = path_to_local_zip as a parameter inside the azurerm_linux_function_app and it still did not work. For all 3 options above, I tried to manually sync the triggers : https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/sync-function-triggers?tryIt=true&source=docs#code-try-0 but that did not work either. How can I make sure the function is triggered?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.