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. App Configuration supports importing from another App Configuration store, an App Service resource or a configuration file in JSON, YAML or .properties.
From the Azure portal, follow these steps:
Browse to your App Configuration store, and select Import/export from the Operations menu.
On the Import tab, select Configuration file under Source service. Other options are App Configuration and App Services.
Fill out the form with the following parameters:
Parameter Description Examples 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 or JSON. JSON Select the Folder icon, and browse to the file to import.
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 which 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. Prefixes can be used to manage groups of keys in a configuration store. TestApp:Settings:Backgroundcolor 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) Select Apply to proceed with the import.
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. You can export data from an App Configuration store, an App Service resource or a configuration file in JSON, YAML or .properties.
From the Azure portal, follow these steps:
Browse to your App Configuration store, and select Import/export.
On the Export tab, select Target service > Configuration file.
Fill out the form with the following parameters:
Parameter Description Example Prefix Optional. A key prefix is the beginning part of a key. Enter a prefix to restrict your export to key-values with the specified prefix. TestApp:Settings:Backgroundcolor 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 without a label will be exported. See note below. prod At a specific time Optional. Fill out to export key-values from a specific point in time. 01/28/2021 12:00:00 AM File type Select the type of file you're importing between YAML, properties or JSON. JSON Separator The separator is the character that will be used in the configuration file to separate the exported key-values from one another. Select one of the following options: .,,,:,;,/,-.; Important
If you don't select a label, only keys 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, so to export keys with multiple labels, you may need to export multiple times, once per label you select.
Select Export to finish the export.
Next steps
Maklum balas
Kirim dan lihat maklum balas untuk