azure app configuration,

Sync Azure App Configuration with GitHub Actions

Sven Malvik Sven Malvik Connect Sep 05, 2020 · 3 mins read
Sync Azure App Configuration with GitHub Actions

One questions we might ask us when we move our properties files from an application to Azure App Configuration is how we can do this without introducing extra complexity when updating our configurations suddenly in a different way. GitHub Actions has an action that synchronizes properties files with Azure App Configuration automatically. It means that we can keep updating our configurations as before, in properties files that are under version control. This blog post is a preparation for my talk on Azure App Configuration and demonstrates this behavior i action.

For this demonstration I chose a Spring Boot application that I used earlier for demonstration purposes. You will find the repository on GitHub (spaceship-azure-app-config-demo application).

Demo ApplicationDemo Application

The repository doesn’t have a properties file yet, so I will add one and set som random key/value pairs.

Adding properties file to repositoryAdding properties file to repository

Next is the GitHub workflow that we will set up. There are lots of predefined workflows to choose from. We are going to set it up ourselves.

Starting GitHub Actions WorkflowStarting GitHub Actions Workflow

We are now in the editor with a workflow file. The file you see at first has lots of printings. I removed everything, and replaced the content with what you see below. I checkout the master branch, set a path for the files I just added, and configured then the GitHub Action Azure App Configuration Sync. This action supports the formats json, yaml, and properties. As most Java applications use properties files, I went with this format as well. You find a full list of input parameters for Azure App Configuration Sync on GitHub.

We also need a connection string for the Azure App Configuration Service that we want to use. You can read how to create an instance of Azure App Configuration in my previous blog post. I copied the connection string from my running instance I already had in place and set it directly in the workflow file - NEVER DO THAT. Instead, set it as a GitHub secret. I just didn’t want to over-complicate this demonstration.

GitHub Actions Workflow file for Azure App Configuration syncGitHub Actions Workflow file for Azure App Configuration sync

To test the workflow I have to trigger it with a commit. I added a new line and made some adjustments in the properties file that I then committed.

Adding entries in properties file to repositoryAdding entries in properties file to repository

Here’s the logging data from the workflow. Everything looks good.

Running GitHub Actions WorkflowRunning GitHub Actions Workflow

Finally checking the configuration data in my Azure App Configuration Service, and voilá, all three configuration entries have been copied over.

Configurations in Azure App ConfigurationConfigurations in Azure App Configuration

Next

The GitHub Action Azure App Configuration Sync gives us a convenient way of moving properties to Azure App Configuration while still keeping the way we update our configurations. We have some legacy Java applications that use properties files, and we wanted to start using Azure App Configurations. With this action, we can keep all configurations close to the application. Now, what happens if I make a change in one configuration in Azure App Configuration? Let’s say we change the title because it has a spelling error. We expect to have this reflected back in the properties. This is of course not possible with a GitHub Action. But it is possible with events in Azure App Configuration which I will cover in a next blog post.

Join Newsletter
Get the latest updates right in your inbox. I never spam!
Sven Malvik
Written by Sven Malvik

Latest Stories

Using App Configuration in Azure DevOps

Application deployments dependent often on environment specific data like the name of a resource group, location or flags for certain use...

Aug 01, 2020

Event-Driven Infrastructure with App Configuration

Azure App Configuration is great for externalizing application configurations. But what if an application is our infrastructure? How coul...

Sep 12, 2020

Azure App Configuration Introduction #3

After playing around with Azure App Configuration Service and how to read a configuration entry with REST, and then using feature flags i...

May 23, 2020

Using Feature Flags with Azure App Configuration

Sometimes we would like to test a new feature of an application. Or we would like to disable code junks because they are not fully implem...

May 16, 2020

How To Manage Azure Virtual Machines

I will go through the first steps for managing Virtual Machines. We will create a Windows VM, start the Internet Information Service IIS,...

Dec 26, 2020

AZ-303 Self-Study Guide for Becoming an Azure Solution Architect

Microsoft updated it’s role based exam for AZ-300. It’s now called AZ-303 and launched last year. This certification is a great proof for...

Feb 01, 2021

Azure App Configuration Introduction

We build this great application that we configure exactly the way it fits into our environments, and then we realize that changing a conf...

May 09, 2020

Logging in Azure API Management

This post is a complete step-by-step guide on how to send logs from Azure API Management to Azure Event Hub with PowerShell. We start by ...

Apr 11, 2020

How to Use Azure Bastion as a Jump Host

Knowing about Azure Bastion is part of the AZ-303 exam for becoming an Azure Solution Architect. Bastion is very useful in cases where yo...

Dec 20, 2020

My Azure Week 34

This blog post is about my reflections on various topics around Azure, and what I have learned and worked on over the past week.

Aug 22, 2020

Serving Website Images from Azure CDN with SSL

In this post I will show you step by step how to serve images on a website from Azure CDN with SSL enabled. My blog has a couple of Azure...

Apr 25, 2020

Latest Stories

Using App Configuration in Azure DevOps

Using App Configuration in Azure DevOps

Application deployments dependent often on environment specific data like the name of a resource group, location or flags for certain use...

Aug 01, 2020

Event-Driven Infrastructure with App Configuration

Event-Driven Infrastructure with App Configuration

Azure App Configuration is great for externalizing application configurations. But what if an application is our infrastructure? How coul...

Sep 12, 2020

Azure App Configuration Introduction #3

Azure App Configuration Introduction #3

After playing around with Azure App Configuration Service and how to read a configuration entry with REST, and then using feature flags i...

May 23, 2020

Using Feature Flags with Azure App Configuration

Using Feature Flags with Azure App Configuration

Sometimes we would like to test a new feature of an application. Or we would like to disable code junks because they are not fully implem...

May 16, 2020

How To Manage Azure Virtual Machines

How To Manage Azure Virtual Machines

I will go through the first steps for managing Virtual Machines. We will create a Windows VM, start the Internet Information Service IIS,...

Dec 26, 2020

AZ-303 Self-Study Guide for Becoming an Azure Solution Architect

AZ-303 Self-Study Guide for Becoming an Azure Solution Architect

Microsoft updated it’s role based exam for AZ-300. It’s now called AZ-303 and launched last year. This certification is a great proof for...

Feb 01, 2021

Azure App Configuration Introduction

Azure App Configuration Introduction

We build this great application that we configure exactly the way it fits into our environments, and then we realize that changing a conf...

May 09, 2020

Logging in Azure API Management

Logging in Azure API Management

This post is a complete step-by-step guide on how to send logs from Azure API Management to Azure Event Hub with PowerShell. We start by ...

Apr 11, 2020

How to Use Azure Bastion as a Jump Host

How to Use Azure Bastion as a Jump Host

Knowing about Azure Bastion is part of the AZ-303 exam for becoming an Azure Solution Architect. Bastion is very useful in cases where yo...

Dec 20, 2020

My Azure Week 34

This blog post is about my reflections on various topics around Azure, and what I have learned and worked on over the past week.

Aug 22, 2020

Serving Website Images from Azure CDN with SSL

Serving Website Images from Azure CDN with SSL

In this post I will show you step by step how to serve images on a website from Azure CDN with SSL enabled. My blog has a couple of Azure...

Apr 25, 2020