Issue: Python Version in Azure App Service Randomly Changing

Jeyaraman, Saranya (Contractor) 0 Reputation points
2025-03-13T14:05:14.0466667+00:00

Description:

The Python version specified under "Stack Settings" in the backend Azure App Service is being automatically changed from Python 3.10 to Python 3.8. This issue has been occurring randomly over the past week.

Additional Note:

This is not happening during deployments.

The cause of the version rollback is unknown.

Looking for insights on potential reasons and how to prevent this from happening.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,452 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Diego Martos 10 Reputation points Microsoft Employee
    2025-03-13T14:44:46.7066667+00:00

    I have a very stable scenario with my Python based application running in Web App hostes in Azure App Service Plan, which leads me to think that something is configured with potential conflicts causing the observation to be perceived as pseudo-random.

    Here are some potential reasons and configurations to consider for possible causes for python version rollback to include or rule out some possible scenarios you may be facing:

    Automated Updates or Maintenance:

    • Azure App Service may perform automated updates or maintenance that could inadvertently change the Python version. Check if there are any scheduled maintenance windows or updates that coincide with the rollback events[1].

    Configuration Conflicts:

      - Conflicts in the configuration settings, such as discrepancies between the portal settings and the underlying infrastructure, might cause the version to revert. Ensure that the Python version is consistently set across all configuration interfaces[[2]](https://learn.microsoft.com/en-us/azure/app-service/configure-language-python).
      
      **App Service Plan SKU:**
      
         - Different SKUs (e.g., Free, Shared, Basic, Standard, Premium) might have varying support for Python versions. Verify that your current SKU supports Python 3.10 and check if upgrading to a higher SKU resolves the issue[[2]](https://learn.microsoft.com/en-us/azure/app-service/configure-language-python).
         
         **Custom Docker Images:**
         
            - If using custom Docker images, ensure that the image is correctly configured to use Python 3.10. Misconfigurations in the Dockerfile or image settings might lead to version changes[[2]](https://learn.microsoft.com/en-us/azure/app-service/configure-language-python).
            
    

    Preventive Measures:

    Locking Python Version:

    • Use the Azure CLI to explicitly set and lock the Python version for your App Service. For example:
        az webapp config set --resource-group <resource-group-name> --name <app-name> --linux-fx-version "PYTHON|3.10"
    

    Monitoring and Alerts:

      - Set up monitoring and alerts to track changes in the Python version. Azure Monitor and Application Insights can help detect and notify you of any unexpected changes[[2]](https://learn.microsoft.com/en-us/azure/app-service/configure-language-python).
      
      **Review Deployment Scripts:**
      
         - Ensure that deployment scripts and automation tools are not inadvertently changing the Python version. Review any CI/CD pipelines for potential issues[[2]](https://learn.microsoft.com/en-us/azure/app-service/configure-language-python).
         
         **Consult Azure Support:**
         
            - If the issue persists, consider reaching out to Azure Support for a deeper investigation. They can provide insights into any backend issues or anomalies[[2]](https://learn.microsoft.com/en-us/azure/app-service/configure-language-python).
            
    

    By systematically checking these areas, you should be able to identify the root cause and prevent further occurrences. Let me know if you need more detailed steps or assistance with any specific configuration!

    References

    [1] Python version on Azure app service mismatch the python version on ...

    [2] Configure Linux Python apps - Azure App Service | Microsoft Learn

    [3] How to change Azure App Service Python version from 3.9.7 to 3.9.12?

    [4] Azure Function App - Python function works with app service plan type ...

    [5] How can one roll back to a previously deployed version #813 - GitHub

    [6] Unable to get Python3.12 running on Azure App services

    [7] Upgrading Python on Azure App Service - Microsoft for Python Developers ...

    [8] https://learn.microsoft.com/en-us/answers/questions/39124/azure-functions-always-using-python-36.htmlLet's investigate this issue together. Here are some potential reasons and configurations to consider:

    0 comments No comments

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.