Share via

Azure App Service Python Version Upgrade

Jester Bojorque 250 Reputation points
2026-04-02T08:24:48.5166667+00:00

Hello,

I just want to confirm if my way of testing is enough to confirm that the app service we use is ok to upgrade to the latest python version:

User's image

I dont have python knowledge or azure cloud I am just learning through browsing the internet.

Currently, I cannot test it in the azure since we do not have an instance of staging, dev or deployment slot where I can test this before updating the python version of our web app in production on Azure.

User's image

I am open for any recommendation or tips where I can assure the compatibility of the current service to the new python version.

It is currently on 3.10 and im planning to upgrade it to 3.11 atleast.

Thank you very much!

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.


1 answer

Sort by: Most helpful
  1. Q&A Assist
    2026-04-02T08:25:10.6033333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The local virtual environment test is a good start, but by itself it doesn’t fully guarantee that the Azure App Service will work after a Python upgrade. Compatibility depends on two things:

    1. The Python version your code and dependencies support.
    2. The Python runtime versions that Azure App Service supports and how the app is configured there.

    From the context:

    • Azure App Service lets the Python version be configured either in the portal (Stack/Version) or via linuxFxVersion using Azure CLI.
    • Outdated runtimes are eventually deprecated and removed from the portal, but apps already using them continue to run until the runtime is fully removed.

    To increase confidence before changing production:

    1. Confirm the target version is supported in App Service
      Use Azure CLI to list supported Python runtimes for Linux:
         az webapp list-runtimes --os linux | grep PYTHON
      
      This shows which exact PYTHON|x.y values are available for your web app.
    2. Match local tests to the Azure runtime
      When creating the local virtual environment, use the same major/minor version that App Service will use (for example, 3.11.x). Install all dependencies with pip install -r requirements.txt and run the application’s own tests or a basic startup test (for example, run the web app locally) to ensure imports and startup succeed.
    3. Plan the change in App Service
      For Linux apps, the Python version is controlled by linuxFxVersion. You can view or set it with Azure CLI:
         az webapp config show \
           --resource-group <resource-group-name> \
           --name <app-name> \
           --query linuxFxVersion
         
         az webapp config set \
           --resource-group <resource-group-name> \
           --name <app-name> \
           --linux-fx-version "PYTHON|3.11"
      
      Replace names as appropriate. This aligns the app with the Python version you tested locally.
    4. Use a non‑production slot when possible
      If deployment slots are added later, first set the new Python version on a staging slot, deploy the app there, verify it runs correctly, and then swap the slot into production. This minimizes downtime and risk.
    5. Be aware of deprecation timelines
      Azure Advisor already recommends upgrading apps off older Python versions as support ends. Keeping the app on a supported version (for example, moving from 3.10 to a newer supported version) avoids losing security updates and support.

    In summary, the local venv test is useful but should be combined with checking supported runtimes in App Service and, ideally, validating on a staging slot before changing production. The actual upgrade in Azure is done by updating the linuxFxVersion/stack version to the desired supported Python version.


    References:

    0 comments No comments

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.