CI/CD Pitfalls with Branches and Azure Functions Uncovered

CI/CD Pitfalls


Azure Functions are a key part of the Microsoft Cloud computing platform. Focusing on integration and continuous delivery, we provide our clients with excellent results with cloud computing. However, while recently building out some Azure Functions for one of our clients, I encountered an unexpected problem while deploying them. I thought I’d share what I found with some of these CI/CD pitfalls.

The Problem and CI/CD Pitfalls

The problem arose during the setup of the CI/CD pipeline. Like most Azure implementations, we wanted to set up 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 lot of time experimenting, digging through logs on the server, and reading through the project Kudu source code, it became clear there was a problem using Zip Deployments. The reason this was so difficult to track down, and there is not much information out there about is that 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 a 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 workaround until the good contributors at Project Kudu can patch the issue.

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 contact us today.

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.