I was having challenge with deploying an Azure Function through Azure DevOps where the default channel was failing to capture the output of the build and deploy it to the target. I wanted to post a template for this, as there were a lot of people trying to solve the same problem, but no clear answer for this specific use case.
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# pip install -r requirements.txt
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
- script: |
python -m pip install --upgrade pip
pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt
displayName: 'Install dependencies'
- task: CopyFiles@2
- task: ArchiveFiles@2
- task: AzureFunctionApp@1
azureSubscription: 'Customer-Project-Production (11111111-1111-1111-1111-111111111111)'
The main mis-match I didn’t have was the correct directory being copied and then sent to the AzureFunctionApp@1