Our great sponsors
-
az-function-fsharp-net5
A minimal example of creating an Azure function using F# on .NET 5. with bonus GitHub actions deployment
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
The final version of the code shown in this blog post can be found on GitHub.
name: Build & Deploy on: push: branches: - master pull_request: env: FUNCTION_PACKAGE_PATH: .publish/function RESOURCE_GROUP: az-function-fsharp-net5 jobs: build-and-deploy: runs-on: ubuntu-18.04 steps: - name: Checkout code uses: actions/checkout@master with: fetch-depth: 0 - name: Setup dotnet SDK 3.1 (https://github.com/Azure/azure-functions-dotnet-worker/issues/480) uses: actions/setup-dotnet@v1 with: dotnet-version: "3.1.409" - name: Setup dotnet SDK uses: actions/setup-dotnet@v1 with: dotnet-version: "5.0.300" - name: Publish Function run: dotnet build src/Function -c Release -o ${{ env.FUNCTION_PACKAGE_PATH }} - name: Login to Azure uses: azure/login@v1 with: creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} - name: Deploy to Azure uses: azure/CLI@v1 with: inlineScript: ./deploy.sh ${{ env.FUNCTION_PACKAGE_PATH }} -g ${{ env.RESOURCE_GROUP }}
Running the function on .NET 5 requires an isolated .NET host Specifically, we have to set the environment variable FUNCTIONS_WORKER_RUNTIME to the value "dotnet-isolated" This is because the default host in the functions runtime is still using .NET Core 3.1 We have to set this in both the local.settings.json file for running locally and the …