az appconfig kv

Manage key-values stored in an App Configuration.

Commands

az appconfig kv delete

Delete key-values.

az appconfig kv export

Export configurations to another place from your App Configuration.

az appconfig kv import

Import configurations into your App Configuration from another place.

az appconfig kv list

List key-values.

az appconfig kv lock

Lock a key-value to prohibit write operations.

az appconfig kv restore

Restore key-values.

az appconfig kv set

Set a key-value.

az appconfig kv set-keyvault

Set a keyvault reference.

az appconfig kv show

Show all attributes of a key-value.

az appconfig kv unlock

Unlock a key-value to gain write operations.

az appconfig kv delete

Delete key-values.

az appconfig kv delete --key
                       [--connection-string]
                       [--label]
                       [--name]
                       [--subscription]
                       [--yes]

Examples

Delete a key using App Configuration name without confirmation.

az appconfig kv delete -n MyAppConfiguration --key color --label MyLabel --yes

Delete a key using connection string.

az appconfig kv delete --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --key color --label MyLabel

Required Parameters

--key

Support star sign as filters, for instance * means all key and abc* means keys with abc as prefix.

Optional Parameters

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--label

If no label specified, delete entry with null label. Support star sign as filters, for instance * means all label and abc* means labels with abc as prefix.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az appconfig kv export

Export configurations to another place from your App Configuration.

az appconfig kv export --destination {appconfig, appservice, file}
                       [--appservice-account]
                       [--connection-string]
                       [--dest-connection-string]
                       [--dest-label]
                       [--dest-name]
                       [--format {json, properties, yaml}]
                       [--key]
                       [--label]
                       [--name]
                       [--naming-convention {camel, hyphen, pascal, underscore}]
                       [--path]
                       [--prefix]
                       [--preserve-labels {false, true}]
                       [--resolve-keyvault {false, true}]
                       [--separator]
                       [--skip-features {false, true}]
                       [--skip-keyvault {false, true}]
                       [--subscription]
                       [--yes]

Examples

Export all keys and feature flags with label test to a json file.

az appconfig kv export -n MyAppConfiguration --label test -d file --path D:/abc.json --format json

Export all keys with null label to an App Service application.

az appconfig kv export -n MyAppConfiguration -d appservice  --appservice-account MyAppService

Export all keys with label test excluding feature flags to a json file.

az appconfig kv export -n MyAppConfiguration --label test -d file --path D:/abc.json --format json --skip-features

Export all keys and feature flags with all labels to another App Configuration.

az appconfig kv export -n MyAppConfiguration -d appconfig --dest-name AnotherAppConfiguration --key * --label * --preserve-labels

Export all keys and feature flags with all labels to another App Configuration and overwrite destination labels.

az appconfig kv export -n MyAppConfiguration -d appconfig --dest-name AnotherAppConfiguration --key * --label * --dest-label ExportedKeys

Required Parameters

--destination -d

The destination of exporting. Note that exporting feature flags to appservice is not supported.

accepted values: appconfig, appservice, file

Optional Parameters

--appservice-account

ARM ID for AppService OR the name of the AppService, assuming it is in the same subscription and resource group as the App Configuration. Required for AppService arguments.

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--dest-connection-string

Combination of access key and endpoint of the destination store.

--dest-label

Exported KVs will be labeled with this destination label. If neither --dest-label nor --preserve-labels is specified, will assign null label.

--dest-name

The name of the destination App Configuration.

--format

File format exporting to. Required for file arguments. Currently, feature flags are not supported in properties format.

accepted values: json, properties, yaml
--key

If no key specified, return all keys by default. Support star sign as filters, for instance abc* means keys with abc as prefix. Key filtering not applicable for feature flags. By default, all feature flags with specified label will be exported.

--label

Only keys and feature flags with this label will be exported. If no label specified, export keys and feature flags with null label by default. Only when export destination is appconfig, we support star sign as filters, for instance * means all labels and abc* means labels with abc as prefix. Label filters are not supported when exporting to file or appservice.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--naming-convention

Naming convention to be used for "Feature Management" section of file. Example: pascal = FeatureManagement, camel = featureManagement, underscore = feature_management, hyphen = feature-management.

accepted values: camel, hyphen, pascal, underscore
default value: pascal
--path

Local configuration file path. Required for file arguments.

--prefix

Prefix to be trimmed from keys. Prefix will be ignored for feature flags.

--preserve-labels

Flag to preserve labels from source AppConfig. This argument should NOT be specified along with --dest-label.

accepted values: false, true
--resolve-keyvault

Resolve the content of key vault reference.

accepted values: false, true
--separator

Delimiter for flattening the key-value pairs to json or yaml file. Required for exporting hierarchical structure. Separator will be ignored for property files and feature flags. Supported values: '.', ',', ';', '-', '_', '__', '/', ':'.

--skip-features

Export items excluding all feature flags. By default, all features with the specified label will be exported to file or appconfig. Not applicable for appservice.

accepted values: false, true
--skip-keyvault

Export items excluding all key vault references. By default, all key vault references with the specified label will be exported.

accepted values: false, true
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for preview.

az appconfig kv import

Import configurations into your App Configuration from another place.

az appconfig kv import --source {appconfig, appservice, file}
                       [--appservice-account]
                       [--connection-string]
                       [--content-type]
                       [--depth]
                       [--format {json, properties, yaml}]
                       [--label]
                       [--name]
                       [--path]
                       [--prefix]
                       [--preserve-labels {false, true}]
                       [--separator]
                       [--skip-features {false, true}]
                       [--src-connection-string]
                       [--src-key]
                       [--src-label]
                       [--src-name]
                       [--subscription]
                       [--yes]

Examples

Import all keys and feature flags from a file and apply test label.

az appconfig kv import -n MyAppConfiguration --label test -s file --path D:/abc.json --format json

Import all keys and feature flags with null label and apply new label from an App Configuration.

az appconfig kv import -n MyAppConfiguration -s appconfig --src-name AnotherAppConfiguration --label ImportedKeys

Import all keys and apply null label from an App Service application.

az appconfig kv import -n MyAppConfiguration -s appservice --appservice-account MyAppService

Import all keys with label test and apply test2 label excluding feature flags from an App Configuration.

az appconfig kv import -n MyAppConfiguration -s appconfig --src-label test --label test2 --src-name AnotherAppConfiguration --skip-features

Import all keys and feature flags with all labels to another App Configuration.

az appconfig kv import -n MyAppConfiguration -s appconfig --src-name AnotherAppConfiguration --src-key * --src-label * --preserve-labels

Import all keys and feature flags from a JSON file and apply JSON content type.

az appconfig kv import -n MyAppConfiguration -s file --path D:/abc.json --format json --separator . --content-type application/json

Required Parameters

--source -s

The source of importing. Note that importing feature flags from appservice is not supported.

accepted values: appconfig, appservice, file

Optional Parameters

--appservice-account

ARM ID for AppService OR the name of the AppService, assuming it is in the same subscription and resource group as the App Configuration. Required for AppService arguments.

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--content-type

Content type of all imported items.

--depth

Depth for flattening the json or yaml file to key-value pairs. Flatten to the deepest level by default if --separator is provided. Not applicable for property files or feature flags.

--format

Imported file format. Required for file arguments. Currently, feature flags are not supported in properties format.

accepted values: json, properties, yaml
--label

Imported KVs and feature flags will be assigned with this label. If no label specified, will assign null label.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--path

Local configuration file path. Required for file arguments.

--prefix

This prefix will be appended to the front of imported keys. Prefix will be ignored for feature flags.

--preserve-labels

Flag to preserve labels from source AppConfig. This argument should NOT be specified along with --label.

accepted values: false, true
--separator

Delimiter for flattening the json or yaml file to key-value pairs. Separator will be ignored for property files and feature flags. Supported values: '.', ',', ';', '-', '_', '__', '/', ':'.

--skip-features

Import only key values and exclude all feature flags. By default, all feature flags will be imported from file or appconfig. Not applicable for appservice.

accepted values: false, true
--src-connection-string

Combination of access key and endpoint of the source store.

--src-key

If no key specified, import all keys by default. Support star sign as filters, for instance abc* means keys with abc as prefix. Key filtering not applicable for feature flags. By default, all feature flags with specified label will be imported.

--src-label

Only keys with this label in source AppConfig will be imported. If no value specified, import keys with null label by default. Support star sign as filters, for instance * means all labels, abc* means labels with abc as prefix.

--src-name

The name of the source App Configuration.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for preview.

az appconfig kv list

List key-values.

az appconfig kv list [--all]
                     [--connection-string]
                     [--datetime]
                     [--fields {content_type, etag, key, label, last_modified, locked, tags, value}]
                     [--key]
                     [--label]
                     [--name]
                     [--query-examples]
                     [--resolve-keyvault {false, true}]
                     [--subscription]
                     [--top]

Examples

List all key-values with null label.

az appconfig kv list -n MyAppConfiguration --label \0

List a specific key for any label start with v1. using connection string.

az appconfig kv list --key color --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --label v1.*

List all keys with any labels and query only key, value and tags.

az appconfig kv list --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --fields key value tags --datetime "2019-05-01T11:24:12Z"

List content of key vault reference with key prefix 'KVRef_' and only select key and value.

az appconfig kv list -n MyAppConfiguration --key "KVRef_*" --resolve-keyvault --query "[*].{key:key, value:value}"

List key-values with multiple labels.

az appconfig kv list --label test,prod,\0 -n MyAppConfiguration

Optional Parameters

--all

List all items.

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--datetime

Format: "YYYY-MM-DDThh:mm:ssZ". If no time zone specified, use UTC by default.

--fields

Space-separated customized output fields.

accepted values: content_type, etag, key, label, last_modified, locked, tags, value
--key

If no key specified, return all keys by default. Support star sign as filters, for instance abc* means keys with abc as prefix.

--label

If no label specified, list all labels. Support star sign as filters, for instance abc* means labels with abc as prefix. Use '0' for null label.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resolve-keyvault

Resolve the content of key vault reference. This argument should NOT be specified along with --fields. Instead use --query for customized query.

accepted values: false, true
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--top -t

Maximum number of items to return. Must be a positive integer. Default to 100.

az appconfig kv lock

Lock a key-value to prohibit write operations.

az appconfig kv lock --key
                     [--connection-string]
                     [--label]
                     [--name]
                     [--subscription]
                     [--yes]

Examples

Lock a key-value using App Configuration name.

az appconfig kv lock -n MyAppConfiguration --key color --label test

Force locking a key-value using connection string.

az appconfig kv lock --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --key color --label test --yes

Required Parameters

--key

Key to be locked.

Optional Parameters

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--label

If no label specified, lock entry with null label. Filtering is not supported.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az appconfig kv restore

Restore key-values.

az appconfig kv restore --datetime
                        [--connection-string]
                        [--key]
                        [--label]
                        [--name]
                        [--subscription]
                        [--yes]

Examples

Restore all key-values to a specific point in time.

az appconfig kv restore -n MyAppConfiguration --datetime "2019-05-01T11:24:12Z"

Restore a specific key for any label start with v1. using connection string to a specific point in time.

az appconfig kv restore --key color --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --label v1.* --datetime "2019-05-01T11:24:12Z"

Required Parameters

--datetime

Format: "YYYY-MM-DDThh:mm:ssZ". If no time zone specified, use UTC by default.

Optional Parameters

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--key

If no key specified, restore all keys by default. Support star sign as filters, for instance abc* means keys with abc as prefix.

--label

If no label specified, restore all key-value pairs with all labels. Support star sign as filters, for instance abc* means labels with abc as prefix. Use '0' for null label.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az appconfig kv set

Set a key-value.

az appconfig kv set --key
                    [--connection-string]
                    [--content-type]
                    [--label]
                    [--name]
                    [--subscription]
                    [--tags]
                    [--value]
                    [--yes]

Examples

Set a key-value with label MyLabel.

az appconfig kv set -n MyAppConfiguration --key color --label MyLabel --value red

Set a key with null label using connection string.

az appconfig kv set --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --key color --value red --tags key1=value1 key2=value2

Set a key with string value and JSON content type.

az appconfig kv set -n MyAppConfiguration --key color --value \"red\" --content-type application/json

Set a key with list value and JSON content type.

az appconfig kv set -n MyAppConfiguration --key options --value [1,2,3] --content-type application/activity+json;charset=utf-8

Set a key with null value and JSON content type.

az appconfig kv set -n MyAppConfiguration --key foo --value null --content-type application/json

Required Parameters

--key

Key to be set. Key cannot be a '.' or '..', or contain the '%' character.

Optional Parameters

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--content-type

Content type of the keyvalue to be set.

--label

If no label specified, set the key with null label by default.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--value

Value of the keyvalue to be set.

--yes -y

Do not prompt for confirmation.

az appconfig kv set-keyvault

Set a keyvault reference.

az appconfig kv set-keyvault --key
                             --secret-identifier
                             [--connection-string]
                             [--label]
                             [--name]
                             [--subscription]
                             [--tags]
                             [--yes]

Examples

Set a keyvault reference with label MyLabel.

az appconfig kv set-keyvault -n MyAppConfiguration --key HostSecret --label MyLabel --secret-identifier https://contoso.vault.azure.net/Secrets/DummySecret/Dummyversion

Set a keyvault reference with null label and multiple tags using connection string.

az appconfig kv set-keyvault --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --key HostSecret --secret-identifier https://contoso.vault.azure.net/Secrets/DummySecret --tags tag1=value1 tag2=value2

Required Parameters

--key

Key to be set. Key cannot be a '.' or '..', or contain the '%' character.

--secret-identifier

ID of the Key Vault object. Can be found using 'az keyvault {collection} show' command, where collection is key, secret or certificate. To set reference to the latest version of your secret, remove version information from secret identifier.

Optional Parameters

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--label

If no label specified, set the key with null label by default.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--yes -y

Do not prompt for confirmation.

az appconfig kv show

Show all attributes of a key-value.

az appconfig kv show --key
                     [--connection-string]
                     [--datetime]
                     [--label]
                     [--name]
                     [--query-examples]
                     [--subscription]

Examples

Show a key-value using App Configuration name with a specific label and datetime

az appconfig kv show -n MyAppConfiguration --key color --label MyLabel --datetime "2019-05-01T11:24:12Z"

Show a key-value using connection string with label

az appconfig kv show --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --key color --label MyLabel

Required Parameters

--key

Key to be showed.

Optional Parameters

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--datetime

Format: "YYYY-MM-DDThh:mm:ssZ". If no time zone specified, use UTC by default.

--label

If no label specified, show entry with null label. Filtering is not supported.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az appconfig kv unlock

Unlock a key-value to gain write operations.

az appconfig kv unlock --key
                       [--connection-string]
                       [--label]
                       [--name]
                       [--subscription]
                       [--yes]

Examples

Unlock a key-value using App Configuration name.

az appconfig kv unlock -n MyAppConfiguration --key color --label test

Force unlocking a key-value using connection string.

az appconfig kv unlock --connection-string Endpoint=https://contoso.azconfig.io;Id=xxx;Secret=xxx --key color --label test --yes

Required Parameters

--key

Key to be unlocked.

Optional Parameters

--connection-string

Combination of access key and endpoint of App Configuration. Can be found using 'az appconfig credential list'. Users can preset it using az configure --defaults appconfig_connection_string=<connection_string> or environment variable with the name AZURE_APPCONFIG_CONNECTION_STRING.

--label

If no label specified, unlock entry with null label. Filtering is not supported.

--name -n

Name of the App Configuration. You can configure the default name using az configure --defaults app_configuration_store=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.