How to change GIT branch in Microsoft Azure App Service

TLDR: in Configuration / Application settings, create a setting named “deployment_branch” with the name of the GIT branch you whant yo use.

Update: I no longer use Microsoft Azure so information on this post may be outdated.

So… me, here, writing about a Microsoft product, Azure.

I have had some projects that have had to be deployed on Microsoft’s Azure App Service and I, obviously, use GIT.

Azure’s App Service ‘Deployment Center’ has option to integrate with Github and Bitbucket but I don’t use those services, my alternative the Local Git option and push the code from my machine to the App Service.

I ran into a problem, Kudo, the deployment engine used by the Azure App Service uses ‘master’ has the default branch, this is fine and makes perfect sense for the production server but I want to be able to set staging and testing servers, or slots, without having to merge those tests to the master branch.

I spent several hours looking for a way to change the branch, read dozens of articles with multiple suggestions, although very frustrating I must say I don’t count the time has completely wasted, I learned a lot about Azure.

The answer ended up being very simple and I found it literally hidden on the very last line of Kudu’s documentation about Deployment branch.

On the App or App slot that you want to change the GIT branch go to Configuration and under ‘Application settings’ create a new application setting named “deployment_branch” with the name of the GIT branch you want yo use.

It’s that simple and elegant, wonder my this isn’t on Azure App Service Documentation.


Posted

in

by