0

I have a pretty simple line on code for import/export App Configuration between different envs.

az appconfig kv export -n appc1 -d file --path abc.json --format json --yes 
az appconfig kv import --name appc2 --source file --format json  --path abc.json --yes 

It works fine, if you need "the same". But, for example, in appc1 I have feature1 in enabled state, in appc2 feature2 - disabled. And when I importing - it's override feature1 (from disable to enable).

Is it possible somehow do not to change feature state if name the same?

nobodyfromhell
  • 321
  • 1
  • 10

3 Answers3

0

Based on MICRSOFT DOCUMENTATION:

Exporting /Importing feature flags from app service is not supported with different configuration(e.g:-abc1-enabled & abc2-disabled).

One of the workaround you may try.

By disabling feature flag of abc1 import the same to abc 2 then enable feature in abc1.

enter image description here

enter image description here

Or by using CLI cmdlts you can enable or disabled feature flag of the particular app configuration.

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15
  • hey. My goal if Feature abc exist and I'm doing import one more time - do not change that feature with new flag. – nobodyfromhell Apr 08 '22 at 20:39
  • Do you mean while import its creating one more new flag – AjayKumarGhose Apr 09 '22 at 01:50
  • when you have item1 with flag disabled and you re-import new file and in that new file you have item1 with flag enabled - it will change your disabled flag to enabled. – nobodyfromhell Apr 10 '22 at 05:31
  • I have tried with multiple ways by using this [MS DOC](https://learn.microsoft.com/en-us/cli/azure/appconfig/kv?view=azure-cli-latest#az-appconfig-kv-import-examples) , but this key function is in preview and not work currently it seems. For more information please refer this latest [**MS DOC|Azure App Configuration support for configuration files**](https://learn.microsoft.com/en-us/azure/azure-app-configuration/concept-config-file) – AjayKumarGhose Apr 19 '22 at 07:30
0

I understand you are looking for an import functionality that will only create new items and not touch the items that already exist in your App Configuration store. This function doesn't exist today. If you use files to manage your data in App Configuration, the files will be considered the source of truth. If you want to enable or disable a feature flag, you should always use file import. So what you have in your App Configuration store is always consistent with what you have in the file.

This document has more discussions about managing configuration data in files https://learn.microsoft.com/en-us/azure/azure-app-configuration/concept-config-file

Zhenlan Wang
  • 1,213
  • 8
  • 10
0

Have you tried using --profile appconfig/kvset ?

az appconfig kv import --profile appconfig/kvset --name your store name --source file --path appconfigdata.json --format json

if you want to touch just one feature flag and remain the others without changes, you can create one JSON file and add in the items section the feature flag that you would like to update or create. You can find the structure of the file in this link: https://learn.microsoft.com/en-us/azure/azure-app-configuration/concept-config-file#file-content-profile-kvset