VSTS & Compiled Azure Functions – How to set up your basic CI/CD pipeline

Introduction

A question that pops up occasionally is how to setup your Azure Functions DevOps flow when you’re using C# underneath. Today’s post will be a brief one to run you through this process. If you should prefer a video on this… That exists too! Curtosiy of the app service product group.

 

Quick Howto

Let’s take a look at the build process. We have (at least, as this flow did not do any testing => “Shame on me!”) three steps in the build process ;

  • Restore the nuget packages
  • Build the solution (and create a single zip file)
  • Publish the artifact

 

So let’s take a look at one of my own builds… First I kick off with installing NuGet on my build agent (should it not already be present).

Afterwards I do the NuGet restore ;

Then we build the solution ;

Here I used the following MSBuild arguments ;

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation=”$(build.artifactstagingdirectory)/package/” /p:DeployIisAppPath=”Default Web Site” /p:OutputPath=”$(build.artifactstagingdirectory)/out/”

The bold path is the instruction where it’ll generate the build package. Oddly enough, at a given time in the past, I had some issues with that part, and I created my own archive step ;

Though I’m pretty sure it could be phased out… Nevertheless, know this is a possibility too!

And once done, we’ll publish the artifact ;

What does a sample build look like now?

If we dive into the “Archive” step, then we see that a zip file has been created at “d:\a\1\a\”, containing our much needed functions files ;

Though, as mentioned, the build solution has a similar one in the “d:\a\1\1\package” directory. So feel free to use that one and omit the archive step for your build!

So what about the release? That’s the “easy” part… 😉 It bears down to an app service deployment.

Which is triggered by the artifact we published.

 

Closing Thoughts

When you are working with a compiled version of functions, then be sure to look into the VSTS integration. It’s a bit of cursing when setting it up, though I hope this posts help in smoothing that process. You will, however, enjoy the compiled version! From experience, I can say that the performance improvement is more than nice. 😉

 

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.