导入或导出配置数据Import or export configuration data

Azure 应用程序配置支持数据导入和导出操作。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 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. 如果要设置与 GitHub 存储库的持续同步,请参阅我们的 GitHub 操作If you’d like to set up an ongoing sync with your GitHub repo, take a look at our GitHub Action.

导入数据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. 应用程序配置支持从 JSON、YAML 或属性文件导入。App Configuration supports importing from a JSON, YAML, or properties file.

使用 Azure 门户Azure CLI 导入数据。Import data by using either the Azure portal or the Azure CLI. 在 Azure 门户中执行以下步骤:From the Azure portal, follow these steps:

  1. 浏览到应用程序配置存储,从“操作”菜单中选择“导入/导出” 。Browse to your App Configuration store, and select Import/Export from the Operations menu.

  2. 在“导入”选项卡上,选择“源服务” > “配置文件” 。On the Import tab, select Source service > Configuration File.

  3. 选择“For 语言”,并选择所需的输入类型。Select For language and select your desired input type.

  4. 选择“文件夹”图标,然后浏览到要导入的文件。Select the Folder icon, and browse to the file to import.

    导入文件

  5. 选择“分隔符”,并选择性地输入“前缀”以用于导入的键名 。Select a Separator, and optionally enter a Prefix to use for imported key names.

  6. 还可以选择“标签”。Optionally, select a Label.

  7. 选择“应用”以完成导入。Select Apply to finish the import.

    文件导入已完成

导出数据Export data

“导出”会将存储在应用程序配置中的配置数据写入另一个目标。Export writes configuration data stored in App Configuration to another destination. 例如,使用导出功能将应用程序配置存储中的数据保存到在部署期间使用应用程序代码嵌入的文件中。Use the export function, for example, to save data in an App Configuration store to a file that's embedded with your application code during deployment.

使用 Azure 门户Azure CLI 导出数据。Export data by using either the Azure portal or the Azure CLI. 在 Azure 门户中执行以下步骤:From the Azure portal, follow these steps:

  1. 浏览到应用程序配置存储,选择“导入/导出”。Browse to your App Configuration store, and select Import/Export.

  2. 在“导出”选项卡上,选择“目标服务” > “配置文件” 。On the Export tab, select Target service > Configuration File.

  3. 选择性地输入“前缀”,并为要导出的键选择“标签”和时间点 。Optionally enter a Prefix and select a Label and a point-in-time for keys to be exported.

  4. 选择“文件类型” > “分隔符” 。Select a File type > Separator.

  5. 选择“应用”以完成导出。Select Apply to finish the export.

    导出文件已完成

后续步骤Next steps