Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

ALM and DevOps practices with a sample compiled .NET method hosted in Azure Function App

Notifications You must be signed in to change notification settings

mathieu-benoit/dot-net-on-azure-function-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ALM and DevOps practices with a sample .NET method hosted in Azure Function App.

TOC

History of changes

  • November 2017
    • Implement CI definition as YAML file PR#5
  • October 2017
    • Update Microsoft.NET.Sdk.Functions to 1.0.6 and xunit to 2.3.0
  • August 2017
    • Implement https://aka.ms/armconditions for the first Staging/CD's VSTS task to avoid deploying Production if it already exists. We don't want to impact existing Production while we are taking care about Staging - - PR#4
    • Add more operational protection with Resource Group Policies - PR#2
    • Convert MSTest projects to xUnit - PR#1
  • July 2017
    • Initial setup.

Overview

Process - Overview

The goal of this GitHub repository is to demonstrate and use DevOps practices by leveraging a very simple compiled .NET method on Azure Function Apps (this Function is just an HttpTrigger saying "Hello" to the name passed in the querystring parameter).

Locally you will need to make sure your Visual Studio 2017 has the Azure Functions Tools extension.

By opening the .sln with Visual Studio you should see the structure of the solution like this:

Visual Studio Solution Structure Overview

To be able to setup the Build and Release definitions within VSTS described in the section below, you will need a Team Services (VSTS) account. If you don't have one, you could create it for free here.

To be able to deploy the Azure services (Function App, Application Insights, etc.), you will need an Azure subscription. If you don't have one, you could create it for free here.

Build Definition with VSTS

Details could be found here: Build - CI

Here are the DevOps practices highlighted within this CI pipeline:

  • CI/Build triggered at each commit on the master branch
  • Compile the .NET library
  • Run Unit tests of the .NET method
  • Infrastructure as Code with the ARM Templates and the PowerShell scripts
  • Expose artifacts to be used then by the CD pipeline (.NET library, ARM Templates, PowerShell scripts and Integration tests dlls)
  • Create a bug work item on build failure (assign to requestor)

Release Definition with VSTS

Details could be found here: Release - CD

Here are the DevOps practices highlighted within this CD pipeline:

  • CD triggered at each CI/Build succesfully completed
  • Deploy the Infrastructure as Code with the ARM Templates and the PowerShell scripts
  • Deploy the .NET method on the Azure serverless service: Azure Function App
  • Run IntegrationTests once the Function App is deployed on Staging
  • Use the Staging Slot mechanism with the associated Swap action to minimize downtime while upgrading to Production
  • Protect the production environment by adding a Lock and Policies on the associated Azure Resource Group
  • Monitor the Function App by using Application Insights
  • Have a dedicated VSTS Release Environment defined for Rollback automated actions.

Other Misc DevOps practices implemented

  • GitHub as source control to leverage key features for collaboration such as feature-branch with pull request, etc.
  • CI/CD definitions as Code with the exported yaml/json file of the Build and Release Definitions respectively

Alternatives and potential further considerations

  • Improvements
    • Instead of allowing 'anonymous' request, setup another AuthorizationLevel for security reason. There is an associated known issue logged here. See my associated stand-by PR#3.
    • Configure VSTS and Microsoft Teams (or Slack or HipChat, etc.) to add more collaboration by setting up notifications once a work item is updated, a commit is done, a build or release or done, etc.
    • Instead of just having a Production environment with its staging slot, having a QA environment with its associated staging too.
  • Alternatives

Resources

About

ALM and DevOps practices with a sample compiled .NET method hosted in Azure Function App

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published