Import or export configuration data

Azure App Configuration supports data import and export operations. Use these operations to work with configuration data in bulk and exchange data between your App Configuration store and code project. For example, you can set up one App Configuration store for testing and another one for production. You can copy application settings between them so that you don't have to enter data twice.

This article provides a guide for importing and exporting data using either the Azure portal or the Azure CLI. If you have adopted Configuration as Code and manage your configurations in GitHub or Azure DevOps, you can set up ongoing configuration file import using GitHub Actions or use the Azure Pipeline Import Task.

Import data

Import brings configuration data into an App Configuration store from an existing source. Use the import function to migrate data into an App Configuration store or aggregate data from multiple sources.

This guide shows how to import App Configuration data:

Import data from a configuration file

Follow the steps below to import key-values from a file.

From the Azure portal, follow these steps:

  1. Navigate to your App Configuration store, and select Import/export from the Operations menu.

    Screenshot of the Azure portal, importing a file.

  2. The Import radio button is selected by default. Under Source type, select Configuration file.

  3. Fill out the form with the following parameters:

    Parameter Description Example
    File type Select the file type for import: YAML, Properties, or JSON. Json
  4. Click the Browse button, and select the file to import.

  5. Fill out the next part of the form:

    Parameter Description Example
    File content profile Select a content profile: Default or KVSet. The Default file content profile refers to the conventional configuration file schema widely adopted by existing programming frameworks or systems, supports JSON, Yaml, or Properties file formats. The KVSet file content profile refers to a file schema that contains all properties of an App Configuration key-value, including key, value, label, content type, and tags. Default
    Import mode The import mode is used to determine whether to ignore identical key-values. With the Ignore match option, any key-values in the store that are the same as those in the configuration file are ignored. With the All option, all key-values in the configuration file are updated. Ignore match
    Exclude feature flag If checked, feature flags will not be imported. Unchecked
    Strict If the box is checked, any key-values in the store with the specified prefix and label that are not included in the configuration file are deleted when the File content profile is set to Default. When the File content profile is set to KVSet, any key-values in the store that are not included in the configuration file are deleted. If the box is unchecked, no key-values in the store will be deleted. Unchecked
    Separator The separator is the delimiter used for flattening JSON or YAML files into key-value. It will be ignored for property files and feature flags. Supported values include no-separator, period (.), comma (,), semicolon (;), hyphen (-), underscore (_), double underscore (__), slash (/), and colon (:). :
    Depth Optional. The depth for flattening JSON or YAML files into key-value pairs. By default, files are flattened to the deepest level if a separator is selected. This setting is not applicable for property files or feature flags.
    Add prefix Optional. If specified, a prefix will be added to the key names of all imported key-values. TestApp:
    Add label Optional. If specified, the provided label will be assigned to all imported key-values. prod
    Add content type Optional. If specified, the provided content type will be added to all imported key-values. JSON (application/json)
    Add tags Optional. If specified, the provided tags will be added to all imported key-values. {tag: tag1}
  6. Select Apply to proceed with the import.

You have successfully imported key-values from a JSON file. The key names were flattened using the : separator and prefixed with TestApp:. All imported key-values are labeled as prod, with a content type of application/json, and tagged with tag: tag1.

Import data from an App Configuration store

You can import values from one App Configuration store to another App Configuration store, or you can import values from one App Configuration store to the same App Configuration store in order to duplicate its values and apply different parameters, such as new label or content type.

Follow the steps below to import key-values and feature flags from an Azure App Configuration store.

From the Azure portal, follow these steps:

  1. Navigate to your App Configuration store, and select Import/export from the Operations menu.

    Screenshot of the Azure portal, importing from an App Configuration store.

  2. The Import radio button is selected by default. Under Source type, select App Configuration.

  3. Select an App Configuration store to import data from, and fill out the form with the following parameters:

    Parameter Description Example
    Subscription Your current subscription is selected by default. my-subscription
    Resource group Select a resource group that contains the App Configuration store with configuration to import. Your current resource group is selected by default. my-resource-group
    Resource Select the App Configuration store that contains the configuration you want to import. my-other-app-config-store
  4. Fill out the next part of the form:

    Parameter Description Example
    Selection mode Select whether to import from regular key-values, which is the default option, or from a snapshot. Default
    Key filter Used to filter key-values based on the key name for import. If no keys are specified, all keys are eligible. Starts with test
    At a specific time Optional. Fill out this field to import key-values from a specific point in time in the selected configuration store. If left empty, it defaults to the current point in time of the key-values. 07/28/2022 12:00:00 AM
    From label Select one or more labels to import key-values associated with those labels. If no label is selected, all labels are eligible. prod
    Exclude feature flag If checked, feature flags will not be imported. Unchecked
    Add prefix Optional. If specified, a prefix will be added to the key names of all imported key-values. TestApp:
    Override labels Optional. By default, the original labels of the source key-values are preserved. To override them, check the box and enter a new label for imported key-values. new
    Override content types Optional. By default, the original content types of the source key-values are preserved. To override them, check the box and enter a new content type for imported key-values. Note that the content type of feature flags cannot be overridden. JSON (application/json)
  5. Select Apply to proceed with the import.

You imported key-values from an App Configuration store as of January 28, 2021, at 12 AM, with key names starting with test and the label prod. The key names were prefixed with TestApp:. All imported key-values were assigned the label new and the content type application/json.

Import data from Azure App Service

Follow the steps below to import key-values from Azure App Service.

Note

App Service doesn't currently support feature flags. All feature flags imported to App Service are converted to key-values automatically. Your App Service resources can only contain key-values.

From the Azure portal:

  1. Navigate to your App Configuration store, and select Import/export from the Operations menu.

    Screenshot of the Azure portal, importing from App Service.

  2. The Import radio button is selected by default. Under Source type, select App Services.

  3. Select an App Configuration store to import data from, and fill out the form with the following parameters:

    Parameter Description Example
    Subscription Your current subscription is selected by default. my-subscription
    Resource group Select a resource group that contains the App Service with configuration to import. my-resource-group
    Resource Select the App Service that contains the configuration you want to import. my-app-service
  4. Fill out the next part of the form:

    Parameter Description Example
    Update settings to reference If checked, the app settings in App Service will be updated to App Configuration references for the imported key-values. This allows you to manage your app settings in App Configuration going forward. Your App Service will automatically pull the current value from App Configuration. To learn more, see Use App Configuration references for App Service and Azure Functions. Checked
    Add prefix Optional. If specified, a prefix will be added to the key names of all imported key-values. TestApp:
    Add label Optional. If specified, the provided label will be assigned to all imported key-values. prod
    Add content type Optional. If specified, the provided content type will be added to all imported key-values. JSON (application/json)
  5. Select Apply to proceed with the import.

You imported all application settings from an App Service as key-values, and assigned them the label prod and the prefix TestApp:. All key-values that you imported have content type set as application/json.

Export data

Export writes configuration data stored in App Configuration to another destination. Use the export function, for example, to save data from an App Configuration store to a file that can be embedded in your application code during deployment.

This guide shows how to export App Configuration data:

Export data to a configuration file

Follow these steps to export configuration data from an App Configuration store to a JSON, YAML, or Properties file.

From the Azure portal, follow these steps:

  1. Navigate to your App Configuration store, and select Import/export.

    Screenshot of the Azure portal, exporting a file

  2. Select the Export radio button and under Target type, select Configuration file.

  3. Fill out the form with the following parameters:

    Parameter Description Example
    File type Select the file type for export: YAML, Properties, or JSON. JSON
    File content profile Select a content profile: Default or KVSet. The Default file content profile refers to the conventional configuration file schema widely adopted by existing programming frameworks or systems, supports JSON, Yaml, or Properties file formats. The KVSet file content profile refers to a file schema that contains all properties of an App Configuration key-value, including key, value, label, content type, and tags. Default
    Selection mode Select whether to export from regular key-values, which is the default option, or from a snapshot. Default
    Key filter Used to filter key-values based on the key name for export. If no keys are specified, all keys are eligible. Starts with TestApp:
    At a specific time Optional. Fill out this field to export key-values from a specific point in time in the selected configuration store. If left empty, it defaults to the current point in time of the key-values. 07/28/2022 12:00:00 AM
    From label Select the label to export key-values associated with those labels. If no label is selected, all labels are eligible. Note that you can only select one label when exporting with the Default file content profile. To export key-values with more than one label, use the KVSet file content profile. prod
    Remove prefix Optional. If specified, the prefix will be removed from the key names of all exported key-values that contain it. TestApp:
    Separator The separator is the delimiter used for segmenting key names and reconstructing hierarchical configurations for JSON or YAML files from key-values. It will be ignored for property files and feature flags. Supported values include no separator, period (.), comma (,), semicolon (;), hyphen (-), underscore (_), double underscore (__), slash (/), and colon (:). :
  4. Select Export to finish the export.

You exported key-values from an App Configuration store as of July 28, 2021, at 12 AM, with key names starting with TestApp: and the label prod, to a JSON file. The prefix TestApp: was trimmed from key names, and the separator : was used to segment the key names and reconstruct the hierarchical JSON format.

Export data to an App Configuration store

Follow the steps below to export key-values and feature flags to an Azure App Configuration store.

You can export values from one App Configuration store to another App Configuration store, or you can export values from one App Configuration store to the same App Configuration store in order to duplicate its values and apply different parameters, such as new label or content type.

From the Azure portal, follow these steps:

  1. Navigate to your App Configuration store that contains the data you want to export, and select Import/export from the Operations menu.

    Screenshot of the Azure portal, exporting from an App Configuration store.

  2. Select the Export radio button and under Target type, select App Configuration.

  3. Fill out the form with the following parameters:

    Parameter Description Example
    Selection mode Select whether to export from regular key-values, which is the default option, or from a snapshot. Default
    Key filter Used to filter key-values based on the key name for export. If no keys are specified, all keys are eligible. Starts with TestApp:
    At a specific time Optional. Fill out this field to export key-values from a specific point in time in the selected configuration store. If left empty, it defaults to the current point in time of the key-values. 07/28/2022 12:00:00 AM
    From label Select one or more labels to export key-values associated with those labels. If no label is selected, all labels are eligible. prod
    Exclude feature flag If checked, feature flags will not be exported. Unchecked
  4. Select destination store, fill out the form with the following parameters:

    Parameter Description Example
    Subscription Your current subscription is selected by default. my-subscription
    Resource group Select a resource group that contains the App Configuration store where you want to export the configuration. Your current resource group is selected by default. my-resource-group
    Resource Select the App Configuration store where you want to export the configuration. my-other-app-config-store
  5. Fill out the next part of the form:

    Parameter Description Example
    Remove prefix Optional. If specified, the prefix will be removed from the key names of all exported key-values that contain it. TestApp:
    Override labels Optional. By default, the original labels of the source key-values are preserved. To override them, check the box and enter a new label for exported key-values. new
    Override content types Optional. By default, the original content types of the source key-values are preserved. To override them, check the box and enter a new content type for exported key-values. Note that the content type of feature flags cannot be overridden. JSON (application/json)
  6. Select Apply to proceed with the export.

You exported key-values from an App Configuration store as of July 28, 2022, at 12 AM, with key names starting with TestApp: and the label prod, to another App Configuration store. All exported key-values were trimmed the key prefix TestApp:, and assigned the label new and the content type application/json.

Export data to Azure App Service

Follow the steps below to export key-values to Azure App Service.

Note

Exporting feature flags to App Service is not supported.

From the Azure portal, follow these steps:

  1. Navigate to your App Configuration store, and select Import/export from the Operations menu.

    Screenshot of the Azure portal, exporting from App Service.

  2. Select the Export radio button and under Target type, select App Services.

  3. The Export as reference option is checked by default. When the box is checked, the application settings in App Service will be added as App Configuration references for the exported key-values. This allows you to manage your settings in App Configuration, with your App Service automatically pulling the current values from App Configuration. To learn more, see Use App Configuration references for App Service and Azure Functions. If the box is unchecked, the key and value will be directly exported to App Service. Remember to export your data again whenever you make changes in App Configuration to ensure your application picks up the updates.

  4. Fill out the form with the following parameters:

    Parameter Description Example
    Selection mode Select whether to export from regular key-values, which is the default option, or from a snapshot. Default
    Key filter Used to filter key-values based on the key name for export. If no keys are specified, all keys are eligible. Starts with TestApp:
    At a specific time Optional. Fill out this field to export key-values from a specific point in time in the selected configuration store. If left empty, it defaults to the current point in time of the key-values. 07/28/2022 12:00:00 AM
    From label Select one label to export key-values associated with this label. prod
  5. Select a destination store and fill out the form with the following parameters:

    Parameter Description Example
    Subscription Your current subscription is selected by default. my-subscription
    Resource group Select a resource group that contains the App Service where you want to export the configuration. my-resource-group
    Resource Select the App Service where you want to export the configuration. my-app-service
  6. Optionally fill out the next part of the form:

    Parameter Description Example
    Remove prefix Optional. If specified, the prefix will be removed from the key names of all exported key-values that contain it. TestApp:
  7. Select Apply to proceed with the export.

You exported key-values from an App Configuration store as of July 28, 2022, at 12 AM, with key names starting with TestApp: and the label prod, to the application settings of an App Service resource. The prefix TestApp: was trimmed from exported key names.

If you checked the box to export key-values as references, the exported key-values are indicated as App Configuration references in the "Source" column of your App Service resource configuration settings.

Screenshot of App Service configuration settings. Exported App Configuration reference in App Service(Portal).

Error messages

You may encounter the following error messages when importing or exporting App Configuration key-values:

  • Public access is disabled for your store or you are accessing from a private endpoint that is not in the store’s private endpoint configurations. If your App Configuration store has private endpoints enabled, you can only access it from within the configured virtual network by default. Ensure that the machine running the Azure portal or CLI is joined to the same virtual network as the private endpoint. If you have just enabled public network access to your App Configuration store, wait at least 5 minutes before retrying to allow the cache to refresh.

Next steps