An Azure service that provides an event-driven serverless compute platform.
Cannot deploy python to Azure Function v2
I have an Azure Function written with VS Code in Python. It runs fine locally and even deploys "successfully" - but it does not show up in Azure portal.
It seems to be related to the modules (requirements.txt), but, I cannot troubleshoot as it works locally and I don't see any logs in Azure.
Please help
Azure Functions
-
Suwarna S Kale • 4,526 Reputation points • Volunteer Moderator2025-05-19T21:00:07.62+00:00 Hello Ahmed Mujovic,
Thank you for posting your question in the Microsoft Q&A forum.
The issue of your Python Azure Function not appearing in the Azure Portal, despite successful deployment, typically stems from dependency resolution failures during deployment or incorrect project structure. While the function works locally, Azure may fail to install modules from requirements.txt silently, preventing the function from registering.
To troubleshoot the issue you may try below steps:
- Verify Deployment Logs: Use az webapp log tail or check Advanced Tools (Kudu) for hidden errors in the deployment logs (https://<yourfunctionapp>.scm.azurewebsites.net).
- Simplify Dependencies: Temporarily reduce requirements.txt to essential packages (e.g., azure-functions) to isolate conflicts.
- Check Project Structure: Ensure your init.py and function.json files are in the correct folder (e.g., /function_name).
- If unresolved, redeploy with --build remote to force Azure-hosted dependency resolution or use a custom container for full control.
The Microsoft documentation link for your reference - https://learn.microsoft.com/en-us/azure/azure-functions/functions-recover-storage-account#python
If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated.
-
Loknathsatyasaivarma Mahali • 2,690 Reputation points • Moderator
2025-05-21T11:12:24.6033333+00:00 Hello Ahmed Mujovic,
I wanted to follow up to see if the response from Suwarna S Kale was helpful. If you have any additional concerns on this matter, please feel free to share them here.
-
Ahmed Mujovic • 0 Reputation points
2025-05-21T14:10:05.7766667+00:00 So, I have to remove all my references in the requirements.txt for it to deploy anything - essentially just a vanilla app. That's not a usable scenario.
How do I deploy a v1 app? Are they still compatible with Functions?
-
Loknathsatyasaivarma Mahali • 2,690 Reputation points • Moderator
2025-05-22T11:17:10.26+00:00 Hello Ahmed Mujovic,
Could you please follow the Azure Functions Python developer guide documentation to deploy a v1 App. Additionally, I confirm that these are compatible with the functions.
-
Anonymous
2025-05-23T05:00:51.1433333+00:00 If your Python Azure Function is not showing up in the Azure Portal despite a successful deployment, the issue is often related to dependency resolution failures or an incorrect project structure. While the function may run locally without issues, Azure can silently fail to install packages listed in requirements.txt, which can prevent the function from being properly registered.
To troubleshoot this issue, try the following steps:
Check Deployment Logs
Use az webapp log tail or explore the Advanced Tools (Kudu) console at https://<yourfunctionapp>.scm.azurewebsites.net to identify any hidden errors during deployment.
Simplify Dependencies
Temporarily reduce your requirements.txt to only the essential packages (e.g., azure-functions) to identify any potential conflicts.
Verify Project Structure
Ensure that your function folders are correctly organized and contain both init.py and function.json files (e.g., in /function_name).
Force Remote Build or Use a Custom Container
Try redeploying with the --build remote flag to let Azure handle dependency installation. Alternatively, consider using a custom Docker container to gain full control over the runtime environment.
If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated.
-
Loknathsatyasaivarma Mahali • 2,690 Reputation points • Moderator
2025-05-26T11:55:38.85+00:00 Hello Ahmed Mujovic,
I wanted to follow up to see if you had a chance to review my previous message about "How do I deploy a v1 app" and if the insights provided by Truc Hoa helped you better understand. If you have any further questions or concerns, please feel free to share them here.
-
Loknathsatyasaivarma Mahali • 2,690 Reputation points • Moderator
2025-05-27T14:25:01.86+00:00 Hello Ahmed Mujovic,
We wanted to follow up on the issue you encountered. Please let us know if it's resolved or if you need further assistance.
-
Ahmed Mujovic • 0 Reputation points
2025-05-27T19:52:04.17+00:00 Hello - we were off for the US holidays. We are trying some of the suggestions now, will report back asap
-
Anonymous
2025-05-28T04:16:24.2333333+00:00 Hi Ahmed Mujovic,
The issue seems to be due to a large dependency listed in your
requirements.txtfile during deployment. Could you please share yourrequirements.txtfile and the project structure? Also, what type of App Service Plan are you using to deploy your project, is it a Flex Consumption, Consumption or another plan? -
Anonymous
2025-05-28T04:43:36.01+00:00 Hi Ahmed Mujovic,
If your project has a large dependency listed in the
requirements.txtfile, the deployment might fail even if you see aDeployment successfulmessage, especially when using theFlex Consumption plan.To fix the issue, you need to deploy your project using the
ZIP deploymentmethod. You can zip your project using the below command.tar -a -c -f functionapp.zip *
Then, use the Azure CLI commands below to log in to your Azure account and deploy the zipped project to your Azure Function App using the Flex Consumption plan.
az login az functionapp deployment source config-zip --resource-group <ResourceGroupName> --name <FunctionAppName> --src functionapp.zip
-
Ahmed Mujovic • 0 Reputation points
2025-05-28T16:04:11.5966667+00:00 So this seems to work, just like in vs code. However, what is strange, I don't see the function on Azure portal, used this cli: az functionapp deployment source config-zip --resource-group tpc-pipelines-ai-poc --name tpc-captios-adf-helpers --src test-deployment.zip
Why doesn't this just work? VERY frustrating
-
Ahmed Mujovic • 0 Reputation points
2025-05-28T21:27:20.08+00:00 So - it looks like the zip deploy has a hard limit of 1GB? Can you confirm?
Also, can you confirm that deploying a function as a container image is only possible from the "container apps environment" SKU?
-
Anonymous
2025-05-29T03:32:11.3166667+00:00 Hi Ahmed Mujovic,
Yes, ZIP deploy has a 1GB limit including extracted files. Container image deployment is also supported in Premium and Flex plans, you can deploy your project to one of those plans.
-
Anonymous
2025-05-30T05:37:17.05+00:00 Hi Ahmed Mujovic,
Following up to check if the issue is resolved or if you need any further assistance. Let me know how it's going!
-
Anonymous
2025-06-02T08:25:29.8266667+00:00 Hi Ahmed Mujovic,
Just checking in to see if above information was helpful. If you have any further updates on this issue, please feel free to post back.
-
Anonymous
2025-06-04T03:32:57.13+00:00 Hi Ahmed Mujovic,
Just following up to see if you had a chance to review my previous message.
Sign in to comment