skip to Main Content

I have a Bicep script that deploys an instance of App Configuration into a resource group.

We use the "incremental mode", as otherwise a deployment of a single instance would delete everything else on that resource group.

However, the problem is that if we delete key-values in the Bicep script (which reads the configs from a JSON file and loops through them to run Microsoft.AppConfiguration/configurationStores/keyValues), the bicep deployment will add any new or changed key-values, but will not delete any removed key-values.

Is there a way to remove all key-values from the App Configuration before adding/updating the new values?

2

Answers


  1. Unfortunately not when using incremental mode. The keyValues are their own freestanding resource so cannot be removed.

    To stay "bicep-only" you’d need to leverage a DeploymentScript resource to do some cleanup for you. It’s a clumsy workaround and I wouldn’t recommend. I’d probably run a cleanup activity as part of my CI/CD pipeline.

    I’d suggest you have a look at the Deployment Stacks preview which (whilst Preview) introduces capabilities to help these kind of scenarios.

    Login or Signup to reply.
  2. You may create key-values with a new label every time, and then any old key-values won’t be included when querying keys with the new label.

    Alternatively, if feasible, the Azure App Configuration pipeline task supports Delete key-values that are not included in the configuration file.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search