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 with App Configuration. If you’d like to set up an ongoing sync with your GitHub repo, take a look at GitHub Actions and Azure Pipeline tasks.

You can import or export data using either the Azure portal or the Azure CLI.

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.

Note

Importing feature flags from a file is not supported. If a configuration file contains feature flags, they will be imported as regular key-values automatically.

From the Azure portal, follow these steps:

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

    Screenshot of the Azure portal, importing a file.

  2. On the Import tab, select Configuration file under Source service.

  3. Fill out the form with the following parameters:

    Parameter Description Example
    For language Choose the language of the file you're importing between .NET, Java (Spring) and Other. .NET
    File type Select the type of file you're importing between Yaml, Properties and Json. Json
  4. Select the Folder icon, and browse to the file to import.

    Note

    A message is displayed on screen, indicating that the file was fetched successfully.

  5. Fill out the next part of the form:

    Parameter Description Example
    Separator The separator is the character parsed in your imported configuration file to separate key-values that will be added to your configuration store. Select one of the following options: ., ,, :, ;, /, -, _, . ;
    Prefix Optional. A key prefix is the beginning part of a key-value's "key" property. Prefixes can be used to manage groups of key-values in a configuration store. The entered prefix will be appended to the front of the "key" property of every key-value you import from this file. TestApp:
    Label Optional. Select an existing label or enter a new label that will be assigned to your imported key-values. prod
    Content type Optional. Indicate if you're importing a JSON file or Key Vault references. For more information about Key Vault references, go to Use Key Vault references in an ASP.NET Core app. JSON (application/json)
  6. Select Apply to proceed with the import.

You've imported key-values from a JSON file, have assigned them the label "prod" and the prefix "TestApp". The separator ":" is used and all the key-values you've imported have content type set as "JSON".

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. Browse 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. On the Import tab, select App Configuration under Source service.

  3. Select Select resource, fill out the form with the following parameters, and select Apply:

    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

    Note

    The message "Access keys fetched successfully" indicates that the connection with the App Configuration store was successful."

  4. Fill out the next part of the form:

    Parameter Description Example
    From label Select at least one label to import values with the corresponding labels. Select all will import key-values with any label, and (No label) will restrict the import to key-values with no label. prod
    At a specific time Optional. Fill out to import key-values from a specific point in time. This is the point in time of the key-values in the selected configuration store. Format: "YYYY-MM-DDThh:mm:ssZ". This field defaults to the current point in time of the key-values when left empty. 07/28/2022 12:00:00 AM
    Override default key-value labels Optional. By default, imported items use their current label. Check the box and enter a label to override these defaults with a custom label. new
    Override default key-value content type Optional. By default, imported items use their current content type. Check the box and select Key Vault Reference or JSON (application/json) under Content type to state that the imported content consists of a Key Vault reference or a JSON file. Content type can only be overridden for imported key-values. Default content type for feature flags is "application/vnd.microsoft.appconfig.ff+json;charset=utf-8' and isn't updated by this parameter. JSON (application/json)
  5. Select Apply to proceed with the import.

You've imported key-values and feature flags with the "prod" label from an App Configuration store on January 28, 2021 at 12 AM, and have assigned them the label "new". All key-values that you have imported have content type set as "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. Browse to your App Configuration store, and select Import/export from the Operations menu.

    Screenshot of the Azure portal, importing from App Service.

  2. On the Import tab, select App Services under Source service.

  3. Select Select resource, fill out the form with the following parameters, and select Apply:

    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

    Note

    A message is displayed, indicating the number of key-values that were successfully fetched from the source App Service resource.

  4. Fill out the next part of the form:

    Parameter Description Example
    Prefix Optional. A key prefix is the beginning part of a key-values's "key" property. Prefixes can be used to manage groups of key-values in a configuration store. This prefix will be appended to the front of the "key" property of each imported key-value. TestApp:
    Label Optional. Select an existing label or enter a new label that will be assigned to your imported key-values. prod
    Content type Optional. Indicate if the file you're importing is a Key Vault reference or a JSON file. For more information about Key Vault references, go to Use Key Vault references in an ASP.NET Core app. JSON (application/json)
  5. Select Apply to proceed with the import.

You've 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 have imported have content type set as "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 the steps below to export configuration data from an app configuration store to a Json, Yaml or Properties file.

Note

Exporting feature flags from an App Configuration store to a configuration file is currently only supported in the CLI.

From the Azure portal, follow these steps:

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

    Screenshot of the Azure portal, exporting a file

  2. On the Export tab, select Configuration file under Target service.

  3. Fill out the form with the following parameters:

    Parameter Description Example
    Prefix Optional. This prefix will be trimmed from each key-value's "key" property. A key prefix is the beginning part of a key. Prefixes can be used to manage groups of key-values in a configuration store. TestApp:
    From label Select an existing label to restrict your export to key-values with a specific label. If you don't select a label, by default only key-values with the "No Label" label will be exported. See note below. prod
    At a specific time Optional. Fill out to import key-values from a specific point in time. This is the point in time of the key-values in the selected configuration store. Format: "YYYY-MM-DDThh:mm:ssZ". This field defaults to the current point in time of the key-values when left empty. 07/28/2022 12:00:00 AM
    File type Select the type of file you're exporting between Yaml, Properties or Json. JSON
    Separator The separator is the delimiter for flattening the key-values to Json/Yaml. It supports the configuration's hierarchical structure and doesn't apply to property files and feature flags. Select one of the following options: ., ,, :, ;, /, -, _, , or (No separator). ;

    Important

    If you don't select a From label, only key-values without labels will be exported. To export a key-value with a label, you must select its label. Note that you can only select one label per export in portal, in case you want to export the key-values with all labels specified please use CLI.

  4. Select Export to finish the export.

You've exported key-values that have the "prod" label from a configuration file, at their state from 07/28/2021 12:00:00 AM, and have trimmed the prefix "TestApp". Values are separated by ";" in the file.

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. Browse to the 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. On the Export tab, select App Configuration under Target service.

  3. Select Select resource, fill out the form with the following parameters, and select Apply:

    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. my-resource-group
    Resource Select the App Configuration store that contains the configuration you want to import. my-app-config-store
  4. The page now displays the selected Target service and resource ID. The Select resource action lets you switch to another source App Configuration store.

    Note

    A message is displayed on screen, indicating that the key-values were fetched successfully.

  5. Fill out the next part of the form:

    Parameter Description Example
    From label Select at least one label to export values with the corresponding labels. Select all will export key-values with any label, and (No label) will restrict the export to key-values with no label. prod
    At a specific time Optional. Fill out to import key-values from a specific point in time. This is the point in time of the key-values in the selected configuration store. Format: "YYYY-MM-DDThh:mm:ssZ". This field defaults to the current point in time of the key-values when left empty. 07/28/2022 12:00:00 AM
    Override default key-value labels Optional. By default, imported items use their current label. Check the box and enter a label to override these defaults with a custom label. new
  6. Select Apply to proceed with the export.

You've exported key-values and feature flags that have the label "prod" from an App Configuration store, at their state from 07/28/2022 12:00:00 AM, and have assigned them the label "new".

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 currently not supported.

From the Azure portal, follow these steps:

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

    Screenshot of the Azure portal, exporting from App Service.

  2. On the Export tab, select App Services under Target service.

  3. Select Select resource, fill out the form with the following parameters, and select Apply:

    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 export. my-resource-group
    Resource Select the App Service that contains the configuration you want to export. my-app-service
  4. The page now displays the selected Target service and resource ID. The Select resource action lets you switch to another target App Service resource.

  5. Optionally fill out the next part of the form:

    Parameter Description Example
    Prefix Optional. This prefix will be trimmed from each exported key-value's "key" property. A key prefix is the beginning part of a key. Prefixes can be used to manage groups of key-values in a configuration store. Prefix will be ignored for feature flags. TestApp:
    Export as reference Optional. Check to export key-values to App Service as App Configuration references. Learn more
    At a specific time Optional. Fill out to export key-values from a specific point in time. This is the point in time of the key-values in the selected configuration store. Format: "YYYY-MM-DDThh:mm:ssZ". This field defaults to the current point in time of the key-values when left empty. 07/28/2022 12:00:00 AM
    From label Optional. Select an existing label to restrict your export to key-values with a specific label. If you don't select a label, only key-values with the "No label" label will be exported. prod
  6. Select Apply to proceed with the export.

You've exported key-values that have the "prod" label from an App Service resource, at their state from 07/28/2021 12:00:00 AM, and have trimmed the prefix "TestApp". The key-values have been exported with a content type in JSON format.

If you checked the box to export key-values as references, the exported key-values will be 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:

  • Selected file must be between 1 and 2097152 bytes.: your file is too large. Select a smaller file.
  • 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. To import key-values from an App Configuration store, you need to have access to that store. If necessary, enable public access for the source store or access it from an approved private endpoint. If you just enabled public access, wait up to 5 minutes for the cache to refresh.

Next steps