0

The Microsoft guide lists 4 methods of deploying App Configurations (in my case to App Services). https://learn.microsoft.com/en-us/azure/azure-app-configuration/howto-best-practices

We currently use last method (push configuration) in combination with labels, specifically:

az appconfig kv export

This works well including for hierarchical keys, which require a double-underscore separator to represent curly braces. However, the development team are transitioning to second method, which is to transition to referencing the keys from the App Service. To do that hierarchical keys require a colon as separator.

The plan was to simply "change" (strictly, recreate) the key from: first__second to first:second. When doing this, however, I notice that the export fails and it is the presence of the colon causing the issue. The error is:

Failed to write key-values to appservice: Operation returned an invalid status 'Bad Request'

This error appears even when the separator is specified:

--seperator ":"

In answer to the question "why export values if you have decided to read the App Configuration from the App Service?" the answer is twofold:

  1. Because the pointer to the App Configuration store (the primary key) still needs to be "pushed".
  2. Because we had hoped to avoid a hard linkage between the code change and the App Config key changes, so we were effectively going to have each key represented at both first__second and first:second at the same time for a short transition period to de-link the two changes.

Does anyone know if there is a way to export keys that have a colon in them? (Or, indeed, if this is just a CLI bug and it should just work?)

Mark
  • 480
  • 1
  • 5
  • 18
  • What is the version of Azure CLI that you're using? Also, can you provide the full export command that fails with this error? Just remove any sensitive information like your store name, appservice account or connection string. – Avani Gupta May 31 '22 at 18:16
  • "azure-cli": "2.37.0" – Mark Jun 07 '22 at 11:37
  • The command line is: az appconfig kv export --name "my-app-config" --destination appservice --label "my-app-service-label" --yes --appservice-account "my-app-ID" – Mark Jun 07 '22 at 11:37
  • I'm unable to reproduce this issue with the same command and same CLI version. I dont think this is due to the colon in key name, and to verify that you can try doing a simple export with this setup: - Create 2 key-values in AppConfig called "Key:1" and "Key__1" with any values. - Make sure your AppService does not contains any AppSetting name "Key:1" or "Key__1" - Export only these 2 key-values using your regular CLI command. If this also produces the same error, we can dig deeper by checking the debug logs from CLI (run the same command with --debug option). – Avani Gupta Jun 08 '22 at 18:31

1 Answers1

0

If you are using --separator property you have to use single colon ':' as described in the MSDOC.

Flattening key-value pairs to a json or yaml file with a delimiter. For exporting hierarchical structures, this is required. For property files and feature flags, the separator will be disregarded.

Delliganesh Sevanesan
  • 4,146
  • 1
  • 5
  • 15
  • I tried with double quotes, singles quotes, no quotes and a good selection of escape characters. They all report the same error. It is the presence of a : in the Key that is the issue. – Mark Jun 07 '22 at 11:34