Continuous Integration and Continuous Deployment with Azure Functions

Intro

Azure Functions are a key part of the Microsoft Cloud computing platform. Recently, while building out some Azure Functions for a client of ours, I ran into an unexpected problem while deploying them. I thought I’d share what I found.

The Problem

The problem arose during setup of the CI/CD pipeline. Like most Azure implementations, we wanted to setup our build and release pipelines using Azure DevOps, which allows us to automatically run unit tests during check-in and automatically deploy code to Azure Function Apps. The setup was extremely smooth with Azure DevOps integration since the codebase was being stored in Azure Repos. The default branch of code (master) deployed perfectly to the Azure Function App.

Azure Function Deploy Pipeline
Azure Function Deploy Pipeline

As smooth as this was, however, I hit a wall when trying to deploy the code from the development branch to a development slot of the Function App. The Azure DevOps deployment logs were not particularly helpful, and web searches turned up little on the problem. After spending a good deal of time experimenting, digging through logs on server, and reading through the project Kudu source code, it become clear there is a problem using Zip Deployments. The reason this was so difficult to track down and there is not much information out there about is because it’s only a problem under the following conditions:

  • You’re deploying a non-default branch (not master), such as a feature or dev branch
  • The deployment method is using:
    • An Azure Function App’s integrated Deployment Center
    • An Azure DevOps pipeline using an Azure Functions task

Both of these deploy using ZipPushDeploy, which at the time of this writing counts on the source branch being the default (master).

The Solution

Taking some advice from fellow business partner and Azure expert, Byron McClain, I tried using an Azure App Service Deploy task from the release pipeline. Since this task’s advanced options let you choose Web Deploy over the default Zip Deploy, I was back in business. This is our work-around until the good contributors at Project Kudu can patch the issue.

Azure Function App Service Deploy
Azure Function App Service Deploy

For more details about the ticket, go here.
For more details about Azure Functions and Serverless Computing, go here.

Happy Azure Trails!

About Rōnin Consulting – Rōnin Consulting provides software engineering and systems integration services for healthcare, financial services, distribution, technology, and other business lines. Services include custom software development and architecture, cloud and hybrid implementations, business analysis, data analysis, and project management for a range of clients from the Fortune 500 to rapidly evolving startups. For more information, please visit our website.

Author:
Ryan Kettrey has been building custom software solutions for the Enterprise for well over 20 years. He has started three software companies, including Ronin Consulting that he currently co-owns with Byron McClain and Chuck Harris.

Contact Us

Give us a call or fill in the form below and we will contact you. We aim to answer all inquiries within 24 hours on business days.