Skip to content

Commit 02b9e31

Browse files
authored
Merge pull request #187676 from maud-lv/maud-tabs
Update import export data instructions
2 parents 1809aa2 + 1503f0e commit 02b9e31

File tree

5 files changed

+139
-31
lines changed

5 files changed

+139
-31
lines changed

articles/azure-app-configuration/howto-import-export-data.md

Lines changed: 110 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,148 @@
22
title: Import or export data with Azure App Configuration
33
description: Learn how to import or export configuration data to or from Azure App Configuration. Exchange data between your App Configuration store and code project.
44
services: azure-app-configuration
5-
author: AlexandraKemperMS
5+
author: maud-lv
66
ms.service: azure-app-configuration
77
ms.topic: conceptual
8-
ms.date: 02/25/2020
9-
ms.author: alkemper
8+
ms.date: 04/06/2022
9+
ms.author: malev
1010
---
1111

1212
# Import or export configuration data
1313

14-
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.
14+
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.
1515

16-
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 our [GitHub Action](./concept-github-action.md).
16+
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](./concept-github-action.md) and [Azure Pipeline tasks](./pull-key-value-devops-pipeline.md).
17+
18+
You can import or export data using either the [Azure portal](https://portal.azure.com) or the [Azure CLI](./scripts/cli-import.md).
1719

1820
## Import data
1921

20-
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 a JSON, YAML, or properties file.
22+
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.
23+
24+
### [Portal](#tab/azure-portal)
25+
26+
From the Azure portal, follow these steps:
27+
28+
1. Browse to your App Configuration store, and select **Import/export** from the **Operations** menu.
2129

22-
Import data by using either the [Azure portal](https://portal.azure.com) or the [Azure CLI](./scripts/cli-import.md). From the Azure portal, follow these steps:
30+
:::image type="content" source="./media/import-file.png" alt-text="Screenshot of the Azure portal, importing a file.":::
2331

24-
1. Browse to your App Configuration store, and select **Import/Export** from the **Operations** menu.
32+
1. On the **Import** tab, select **Configuration file** under **Source service**. Other options are **App Configuration** and **App Services**.
2533

26-
1. On the **Import** tab, select **Source service** > **Configuration File**.
34+
1. Fill out the form with the following parameters:
2735

28-
1. Select **For language** and select your desired input type.
36+
| Parameter | Description | Examples |
37+
|--------------|------------------------------------------------------------------------------------------|---------|
38+
| For language | Choose the language of the file you're importing between .NET, Java (Spring) and Other. | .NET |
39+
| File type | Select the type of file you're importing between YAML, properties or JSON. | JSON |
2940

3041
1. Select the **Folder** icon, and browse to the file to import.
3142

32-
![Import file](./media/import-file.png)
43+
1. Fill out the next part of the form:
44+
45+
| Parameter | Description | Example |
46+
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
47+
| 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: `.`, `,`,`:`, `;`, `/`, `-`. | : |
48+
| 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 |
49+
| Label | Optional. Select an existing label or enter a new label that will be assigned to your imported key-values. | prod |
50+
| 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](/azure/azure-app-configuration/use-key-vault-references-dotnet-core). | JSON (application/json) |
51+
52+
1. Select **Apply** to proceed with the import.
53+
54+
### [Azure CLI](#tab/azure-cli)
55+
56+
Use the Azure CLI as explained below to import App Configuration data. If you don't have the Azure CLI installed locally, you can optionally use [Azure Cloud Shell](/azure/cloud-shell/overview). Specify the source of the data: `appconfig`, `appservice` or `file`. Optionally specify a source label with `--src-label` and a label to apply with `--label`.
3357

34-
1. Select a **Separator**, and optionally enter a **Prefix** to use for imported key names.
58+
Import all keys and feature flags from a file and apply test label.
3559

36-
1. Optionally, select a **Label**.
60+
```azurecli
61+
az appconfig kv import --name <your-app-config-store-name> --label test --source file --path D:/abc.json --format json
62+
```
3763

38-
1. Select **Apply** to finish the import.
64+
Import all keys with label test and apply test2 label.
3965

40-
![Import file finished](./media/import-file-complete.png)
66+
```azurecli
67+
az appconfig kv import --name <your-app-config-store-name> --source appconfig --src-label test --label test2 --src-name <another-app-config-store-name>
68+
```
69+
70+
Import all keys and apply null label from an App Service application.
71+
72+
For `--appservice-account` use the ARM ID for AppService or use the name of the AppService, assuming it's in the same subscription and resource group as the App Configuration.
73+
74+
```python
75+
az appconfig kv import --name <your-app-config-store-name> --source appservice --appservice-account <your-app-service>
76+
```
77+
78+
For more details and examples, go to [az appconfig kv import](/cli/azure/appconfig/kv?view=azure-cli-latest#az-appconfig-kv-import&preserve-view=true).
79+
80+
---
4181

4282
## Export data
4383

44-
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.
84+
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.
85+
86+
### [Portal](#tab/azure-portal)
4587

46-
Export data by using either the [Azure portal](https://portal.azure.com) or the [Azure CLI](./scripts/cli-export.md). From the Azure portal, follow these steps:
88+
From the [Azure portal](https://portal.azure.com), follow these steps:
4789

48-
1. Browse to your App Configuration store, and select **Import/Export**.
90+
1. Browse to your App Configuration store, and select **Import/export**.
4991

50-
1. On the **Export** tab, select **Target service** > **Configuration File**.
92+
1. On the **Export** tab, select **Target service** > **Configuration file**.
5193

52-
1. Optionally enter a **Prefix** and select a **Label** and a point-in-time for keys to be exported.
94+
1. Fill out the form with the following parameters:
5395

54-
1. Select a **File type** > **Separator**.
96+
| Parameter | Description | Example |
97+
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|
98+
| 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 |
99+
| 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 |
100+
| At a specific time | Optional. Fill out to export key-values from a specific point in time. | 01/28/2021 12:00:00 AM |
101+
| File type | Select the type of file you're importing between YAML, properties or JSON. | JSON |
102+
| 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: `.`, `,`,`:`, `;`, `/`, `-`. | ; |
55103

56-
1. Select **Apply** to finish the export.
104+
> [!IMPORTANT]
105+
> 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.
57106
58-
![Export file finished](./media/export-file-complete.png)
107+
1. Select **Export** to finish the export.
108+
109+
:::image type="content" source="./media/export-file-complete.png" alt-text="Screenshot of the Azure portal, exporting a file":::
110+
111+
### [Azure CLI](#tab/azure-cli)
112+
113+
Use the Azure CLI as explained below to export configurations from App Configuration to another place. If you don't have the Azure CLI installed locally, you can optionally use [Azure Cloud Shell](/azure/cloud-shell/overview). Specify the destination of the data: `appconfig`, `appservice` or `file`. Specify a label for the data you want to export with `--label` or export data with no label by not entering a label.
114+
115+
> [!IMPORTANT]
116+
> If the keys you want to export have labels, do select the corresponding labels. If you don't select a label, only keys without labels will be exported.
117+
118+
Export all keys and feature flags with label test to a json file.
119+
120+
```python
121+
az appconfig kv export --name <your-app-config-store-name> --label test --destination file --path D:/abc.json --format json
122+
```
123+
124+
Export all keys with null label excluding feature flags to a json file.
125+
126+
```python
127+
az appconfig kv export --name <your-app-config-store-name> --destination file --path D:/abc.json --format json --skip-features
128+
```
129+
130+
Export all keys and feature flags with all labels to another App Configuration.
131+
132+
```python
133+
az appconfig kv export --name <your-app-config-store-name> --destination appconfig --dest-name <another-app-config-store-name> --key * --label * --preserve-labels
134+
```
135+
136+
Export all keys and feature flags with all labels to another App Configuration and overwrite destination labels.
137+
138+
```python
139+
az appconfig kv export --name <your-app-config-store-name> --destination appconfig --dest-name <another-app-config-store-name> --key * --label * --dest-label ExportedKeys
140+
```
141+
142+
For more details and examples, go to [az appconfig kv export](/cli/azure/appconfig/kv?view=azure-cli-latest#az-appconfig-kv-export&preserve-view=true).
143+
144+
---
59145

60146
## Next steps
61147

62148
> [!div class="nextstepaction"]
63-
> [Create an ASP.NET Core web app](./quickstart-aspnet-core-app.md)
149+
> [Create an ASP.NET Core web app](./quickstart-aspnet-core-app.md)
-20.2 KB
Loading
7.01 KB
Loading
111 KB
Loading

articles/azure-app-configuration/quickstart-dotnet-core-app.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Quickstart for Azure App Configuration with .NET Core | Microsoft Docs
33
description: In this quickstart, create a .NET Core app with Azure App Configuration to centralize storage and management of application settings separate from your code.
44
services: azure-app-configuration
5-
author: AlexandraKemperMS
5+
author: maud-lv
66
ms.service: azure-app-configuration
77
ms.devlang: csharp
88
ms.topic: quickstart
99
ms.custom: devx-track-csharp, mode-other
10-
ms.date: 09/28/2020
11-
ms.author: alkemper
10+
ms.date: 04/05/2022
11+
ms.author: malev
1212
#Customer intent: As a .NET Core developer, I want to manage all my app settings in one place.
1313
---
1414
# Quickstart: Create a .NET Core app with App Configuration
@@ -84,31 +84,53 @@ You use the [.NET Core command-line interface (CLI)](/dotnet/core/tools/) to cre
8484
8585
1. Set an environment variable named **ConnectionString**, and set it to the access key to your App Configuration store. At the command line, run the following command:
8686
87-
```cmd
87+
### [Windows command prompt](#tab/windowscommandprompt)
88+
89+
To build and run the app locally using the Windows command prompt, run the following command:
90+
91+
```console
8892
setx ConnectionString "connection-string-of-your-app-configuration-store"
8993
```
9094
95+
Restart the command prompt to allow the change to take effect. Print the value of the environment variable to validate that it is set properly.
96+
97+
### [PowerShell](#tab/powershell)
98+
9199
If you use Windows PowerShell, run the following command:
92100
93101
```azurepowershell
94102
$Env:ConnectionString = "connection-string-of-your-app-configuration-store"
95103
```
96104
97-
If you use macOS or Linux, run the following command:
105+
### [macOS](#tab/unix)
106+
107+
If you use macOS, run the following command:
108+
109+
```console
110+
export ConnectionString='connection-string-of-your-app-configuration-store'
111+
```
112+
113+
Restart the command prompt to allow the change to take effect. Print the value of the environment variable to validate that it is set properly.
114+
115+
### [Linux](#tab/linux)
116+
117+
If you use Linux, run the following command:
98118
99119
```console
100120
export ConnectionString='connection-string-of-your-app-configuration-store'
101121
```
102122
103123
Restart the command prompt to allow the change to take effect. Print the value of the environment variable to validate that it is set properly.
104124
105-
2. Run the following command to build the console app:
125+
---
126+
127+
1. Run the following command to build the console app:
106128
107129
```dotnetcli
108130
dotnet build
109131
```
110132
111-
3. After the build successfully completes, run the following command to run the app locally:
133+
1. After the build successfully completes, run the following command to run the app locally:
112134
113135
```dotnetcli
114136
dotnet run

0 commit comments

Comments
 (0)