/MinimalFunctions

Mostly minimal .NET 6.0 preview APIs in Azure Functions

Primary LanguageC#MIT LicenseMIT

MinimalFunctions

(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:

  1. Fork this repo

  2. Create a Functions app using a new resource group named minimalfunction, .NET 3.1 runtime, Windows hosting

  3. 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-auth Note the use of the resource group as the scope, not just the web app (didn't work with that for me).

  4. Copy the resulting json and set it as a repository secret named AZURE_CREDENTIALS

  5. Add another repository secret named AZURE_APPNAME with your function app name for deployment

  6. 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 with func azure functionapp publish ${{ secrets.AZURE_APPNAME }} --force.

    Using --no-build option didn't work for me. Additional build args can be passed at the end with --dotnet-cli-params -- -p:PROP=VALUE ....