Publish Azure Functions via Jenkins CI Continuously to Azure

Georg Dangl by Georg Dangl in Continuous Integration Monday, November 06, 2017

Monday, November 06, 2017

Publish Azure Functions via Jenkins CI Continuously to Azure
Posted in Jenkins Azure

We're not exactly heavily oriented towards a microservice architecture, but we do use them a fair bit for some resource intensive methods. I'm pretty happy with Azure Functions, especially with the parts that I can automate: I'll describe how to setup a simple Jenkins job that builds your function and deploys it automatically to Azure Functions.

In your projects repository, you need a build script to compile your function, like this:

It's not too complicated, but I want to highlight these points:

  • Following best practices, $deployUsername and $deployPassword are passed as parameters to the function so we're not storing any sensitive date in source control
  • dotnet build doesn't yet work with Azure Functions, so the script is using MSBuild. It's easiest to get by simply installing the Visual Studio 2017 Community Edition on your CI server (which I recommend anyways, since it comes with all the SDKs you ever need)
  • You have to insert your own values for the placeholders, <ProjectFolder> and <FunctionName>. This could also be parameterized if you intend to have a more complex deployment scenario

In Jenkins, you simply call this script and provide the required parameters:

Jenkins Azure Functions Deployment with WebDeploy Configuration

I really encourage you to use something like the Credentials Binding Plugin to provide your secrets. Otherwise, it's as simple as a setup can be. You can set up Git Hooks or use the GitHub plugin to automatically build whenever you push new code.

If you're wondering where to actually get your deployment credentials, they're included in the Publishing Profile that you can download for the function in the Azure portal.

Happy deploying!

Share this post

comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.


Need a consultant for BIM, GAEB or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

// Just 💗 Coding

Social Links