Share via

Azure function code doesn't gets update

Ananay Ojha 91 Reputation points
2026-02-13T15:18:55.63+00:00

Dear Experts, requesting your guidance on below issue:

Problem: Though I see latest updated function_app.py in azure portal but when running function, its still shows behavior of old code. Observing it from past 3 days.

I tried:

  • Restarting app after each deployments
  • Waited for more than 24 hours for it to show new code's behaviour
  • Changed Deployment method (but with func core tools and az cli it gives error: deployment failed with no other context, why it failed)

Function App Plan: Flex Consumption Plan | Region: UAE North | Networking: Open to Internet

Deployment method: Via Azure Pipeline, gets successful every time. code attached.

User's image

trigger: none

pool:
  vmImage: ubuntu-22.04

variables:
  sc: 'sc-dev-01'
  appName: 'isdb-jiradataextract-function'
  dir: $(Build.SourcesDirectory)
  pyVersion: '3.13'

steps:
- task: UsePythonVersion@0
  displayName: "Set Python version to 3.13"
  inputs:
    versionSpec: $(pyVersion)
    disableDownloadFromRegistry: true
    addToPath: true
    architecture: 'x64'

- bash: |
    if [ -f extensions.csproj ]
    then
        dotnet build extensions.csproj --output ./bin
    fi
    pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt
  workingDirectory: $(dir)
  displayName: Install Lib

- task: DownloadSecureFile@1
  name: deltaFile
  inputs:
    secureFile: 'delta_sharing_profile.json'

- bash: |
    mkdir $(dir)/credentials
    cp $(deltaFile.secureFilePath) $(dir)/credentials/

- task: ArchiveFiles@2
  displayName: "Archive files"
  inputs:
    rootFolderOrFile: "$(System.DefaultWorkingDirectory)"
    includeRootFolder: false
    archiveFile: "$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip"

- task: PublishBuildArtifacts@1
  displayName: Publish zip
  inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip'
    artifactName: 'drop'

- task: AzureFunctionApp@2 
  displayName: Deploy 
  inputs:
    azureSubscription: $(sc)
    appType: functionAppLinux # This specifies a Linux-based function app
    isFlexConsumption: true # Uncomment this line if you are deploying to a Flex Consumption app
    appName: $(appName)
    package: $(System.DefaultWorkingDirectory)/build$(Build.BuildId).zip
    deploymentMethod: 'auto'

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Alex Burlachenko 22,120 Reputation points MVP Volunteer Moderator
    2026-02-16T08:20:44.87+00:00

    hi, Ananay Ojha,

    :) in real life is that the deployment says success but the function runtime is still executing an older package. In flex consumption the app runs from a deployed zip package, so if that package is not actually being replaced properly the worker will just keep using the previous build even though the portal shows ur updated function_app.py.

    i would like to look if the app settings and see what website_run_from_package is set to, if it points to a specific blob url instead of just 1 then it might still be referencing an older package.

    open kudu and look at what is actually inside /home/site/wwwroot at runtime because sometimes what u see in the portal editor is not what the worker process is executing.

    See ur archive step because u are zipping system.defaultworkingdirectory which can include extra files or stale artifacts instead of just the actual function project folder, so it is possible the wrong content is being packaged and deployed.

    this kind of issue is almost always related to packaging or run from package configuration rather than azure taking three days to refresh code.

    rgds,

    Alex

    Was this answer helpful?


  2. Praveen Kumar Gudipudi 2,290 Reputation points Microsoft External Staff Moderator
    2026-02-16T07:57:57.3833333+00:00

    Hello Ananay Ojha,

    Thanks for reaching out.

    From the behavior you described—where the updated function_app.py file is visible in the portal but the function runtime continues to execute older logic—this is a known scenario with Flex Consumption (Linux) deployments in Microsoft Azure. In this hosting model, the function runtime executes code from the mounted deployment package rather than directly from the extracted files shown in the portal. If the mounted package is not refreshed correctly, the function may continue running older code even though deployment reports success.

    To resolve this, please follow the recommendations below:

    1. Ensure Run-From-Package is enabled Set the application setting:
         WEBSITE_RUN_FROM_PACKAGE = 1
      
      After applying the setting, perform a Stop → wait ~60 seconds → Start sequence (instead of Restart) and then redeploy. This forces the runtime to mount the latest package. Verify supported Python runtime version Azure Functions Flex Consumption currently supports Python 3.10 and 3.11. If the pipeline builds with an unsupported version (such as 3.13), deployment may appear successful while the runtime silently continues using the last valid package.

    After applying the above changes, the function runtime should begin executing the latest deployed code.

    Please accept as answer and do a Thumbs-up to upvote this response if you are satisfied with the community help. Your upvote will be beneficial for the community users facing similar issues.

    Was this answer helpful?


Your answer

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