I faced the same issue: deployment from VS Code worked smoothly, but when deploying from GitHub using the default .yml
workflow generated by the Azure Portal, none of the libraries from requirements.txt were installed. This resulted in ModuleNotFoundError
, or an empty list of functions on Azure Portal.
Solution 1 (with Remote Build):
Forcing remote build with Oryx resolved the issue. While documentation suggests setting environmental variables, these settings are ignored or overwritten as false
by @Azure/functions-action@v1
unless explicitly stated in the .yml
file.
# ...
- name: 'Deploy to Azure Functions'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: '...'
slot-name: 'Production'
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ ... }}
scm-do-build-during-deployment: true # <--- ADDED THIS LINE
enable-oryx-build: true # <--- ADDED THIS LINE
I tested this solution successfully on:
- Consumption plan
- Consumption Flex
- App Service
Solution 2 (without Remote Build):
If I understand the documentation correctly, Linux Consumption plan apps cannot use this option. However, it works on the App Service plan (and possibly on Premium and Container plans, though I haven’t tested those). It does not work on Consumption and Consumption Flex plans.
For some reason, the active venv
does not persist between steps. Reactivating the venv
before running pip install
resolved the issue:
# ...
- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: | # <--- EDITED THESE 2 LINES vvv
source venv/bin/activate
pip install -r requirements.txt
# Optional: Add step to run tests here
- name: Zip artifact for deployment
run: zip release.zip ./* -r
# ...
Key Insights:
The Azure/functions-action@v1
assumes default values for scm-do-build-during-deployment
and enable-oryx-build
as false
when nothing is provided. This is evident from the GitHub Actions logs:
Run Azure/functions-action@v1
with:
app-name:
slot-name: Production
package: .
publish-profile: ***
respect-pom-xml: false
respect-funcignore: false
scm-do-build-during-deployment: false
enable-oryx-build: false
remote-build: false
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: .
Successfully parsed SCM credential from publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Successfully acquired app settings from function app (with SCM credential)!
Will archive . into /home/runner/work/_temp/temp_web_package_5208750022074267.zip as function app content
Will use Kudu https://<scmsite>/api/zipdeploy to deploy since publish-profile is detected.
Setting SCM_DO_BUILD_DURING_DEPLOYMENT in Kudu container to false
Update using context.kuduService.updateAppSettingViaKudu
Response with status code 204
App setting SCM_DO_BUILD_DURING_DEPLOYMENT propagated to Kudu container
Setting ENABLE_ORYX_BUILD in Kudu container to false
Update using context.kuduService.updateAppSettingViaKudu
Response with status code 204
App setting ENABLE_ORYX_BUILD propagated to Kudu container
Package deployment using ZIP Deploy initiated.
Deploy logs can be viewed at ...
Successfully deployed web package to App Service.
Restoring SCM_DO_BUILD_DURING_DEPLOYMENT in Kudu container to 1
Response with status code 204
Restoring ENABLE_ORYX_BUILD in Kudu container to 1
Response with status code 204
This process temporarily sets the environmental variables to false
(or true
), does not build, and then reverts to the original values.
For ZIP deployment, the venv
was originally empty, with no installed libraries like requests
, msal
, or azure-cosmos
.

Here are the .yml
files that worked for me:
Also, the Azure workflow sample from Github should work as well.