(Mostly) Minimal .NET 6.0 (preview) APIs in Azure Functions
End-to-end example of building and deploying .NET 6 APIs to Azure Functions (current stable, v3) runtime using GitHub actions.
Steps to get (this) end-to-end .NET6 function running in Azure Functions:
-
Fork this repo
-
Create a Functions app using a new resource group named
minimalfunction, .NET 3.1 runtime, Windows hosting -
Using the Azure CLI, create credentials for the deployment with:
az ad sp create-for-rbac --name minimalfunction --role contributor --scopes "/subscriptions/[SUBSCRIPTION_ID]/resourceGroups/minimalfunction" --sdk-authNote the use of the resource group as the scope, not just the web app (didn't work with that for me). -
Copy the resulting json and set it as a repository secret named
AZURE_CREDENTIALS -
Add another repository secret named
AZURE_APPNAMEwith your function app name for deployment -
The build script needs to install func v4 with
npm i -g azure-functions-core-tools@4 --unsafe-perm true, and then do the publish withfunc azure functionapp publish ${{ secrets.AZURE_APPNAME }} --force.Using
--no-buildoption didn't work for me. Additional build args can be passed at the end with--dotnet-cli-params -- -p:PROP=VALUE ....