Reputation: 3
I am attempting to deploy a .Net 8 function app to a flex consumption plan on our Azure subscription. However, when I run the action, after the build, I get the error "Error: Couldn't detect a version for the platform 'dotnet' in the repo."
name: Deploy DotNet project to Azure Function App
on:
push:
branches: ["main"]
env:
AZURE_FUNCTIONAPP_NAME: 'function app name'
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
DOTNET_VERSION: '8.0.x'
jobs:
build-and-deploy:
runs-on: windows-latest # For Linux, use ubuntu-latest
environment: dev
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
# If you want to use Azure RBAC instead of Publish Profile, then uncomment the task below
# - name: 'Login via Azure CLI'
# uses: azure/login@v1
# with:
# creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} # set up AZURE_RBAC_CREDENTIALS secrets in your repository
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
sku: flexconsumption
remote-build: true
scm-do-build-during-deployment: false
enable-oryx-build: false
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
I have declared the dotnet version as a variable in the workflow file, and I have checked the solution and the .csproj file and they include the dotnet version as well.
Upvotes: 0
Views: 485
Reputation: 166
Flex Consumption deployment is now supported in Visual Studio, VS Code, Azure Functions Core Tools, Azure Developer CLI (AZD), AZ CLI, GitHub Actions, Azure Pipelines task, and Java tooling like Maven.
Upvotes: 0
Reputation: 6497
AZURE_FUNCTIONAPP_PUBLISH_PROFILE
in secrets and variables tab.name: Deploy DotNet project to Azure Function App
on:
push:
branches: ["main"]
env:
AZURE_FUNCTIONAPP_NAME: 'afreen-fa'
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
DOTNET_VERSION: '8.0.x'
jobs:
build-and-deploy:
runs-on: ubuntu-latest # For ubuntu-latest, use windows-latest
environment: dev
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh # For Linux, use bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
scm_url + /api/publish
whereas it is using scm_url + /api/zipdeploy
.
Upvotes: 0