Giter VIP home page Giter VIP logo

azure-functions-dotnet-5-sample's Introduction

Azure Functions .NET 5 Sample Project

Sample GitHub Actions CI/CD Pipeline for Azure Function .NET 5 Isolated Process.

Public docs for Azure Functions with the new .NET 5 isolated process setup can be found below,

https://docs.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide

The public GitHub repo for the Azure Functions dotnet Worker is below,

https://github.com/Azure/azure-functions-dotnet-worker

And the public GitHub repo for the Azure Functions Core commandline tooling can be found here,

https://github.com/Azure/azure-functions-core-tools

Setup Notes

  1. Clone/fork this repo
  2. Create a local file in the root of the Sample.FunctionApp project local.settings.json. There is a .gitignore setting to not check this file into source code. A sample local.settings.json is below. You can also download a full sample here.
{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
    }
}
  1. Create an Azure Function resource in your own Azure subscription. Public docs on how to do this can be found here.

You can choose two different options below for how to get the Azure Function App deployed :)

Option 1: Deploying with Azure Functions GitHub Action

See YAML file dotnet.yml here.

  1. Go to your Azure Function App overview blade. Download the publish profile. Open up the txt file and copy the entire contents.

Download Publish Profile Image

  1. Save the contents as a GitHub Action Secret titled AZURE_FUNCTION_PUBLISH_CREDS
  2. Kick off the GitHub Action to deploy your .NET 5 Isotated Processs Azure Function App!

NOTE: if you see the following error, you need to remove the settting WEBSITE_RUN_FROM_PACKAGE from the configuration blade of your Azure Function App in the Azure Portal,

When request Azure resource at PublishContent, zipDepoy : WEBSITE_RUN_FROM_PACKAGE in your function app is set to an URL. Please remove WEBSITE_RUN_FROM_PACKAGE app setting from your function app.

Option 2: Deploying with the Azure Function Core Tools

See YAML file dotnet2.yml here.

  1. Create an AAD Service Principal that has contribute permissions to the Azure Function resource. Easiest way to do this is to launch the Azure Cloud Shell in the Azure Portal
az ad sp create-for-rbac --name "<FUNCTION_APP_NAME>-sp" --sdk-auth --role contributor --scopes /subscriptions/<SUBSCRIPTION_GUID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Web/sites/<FUNCTION_APP_NAME>
  1. Once you complete this, you will see the new Service Principal with an assigned contributor role in the IAM blade for the Azure Function App,

IAM Security View

  1. Save the entire JSON output of the PowerShell operations to a GitHub Action Secret with the name AZURE_CREDS_FUNCTION_APP. This enables you to securely reference this credential in GitHub Actions to authenticate to Azure.
  2. Update the dotnet2.yml file to specify the actual Azure Function resource name you created previously. Snippet included below, the full YAML file can be found here
env:
  AZURE_FUNCTIONAPP_NAME: <ACTUAL_FUNCTION_RESOURCE_NAME> # set this to the name of your azure function app resource
  AZURE_FUNCTION_PROJ_PATH: src/Sample.FunctionApp  # set this to the path to your function app project
  ROOT_SOLUTION_PATH: src # set this to the root path of your solution/project file
  1. Kick off the GitHub Action to deploy your .NET 5 Isolated Process Azure Function App!

azure-functions-dotnet-5-sample's People

Contributors

stevewinward avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.