You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this article, you'll learn how to set up an automatic backup of key-values from a primary Azure App Configuration store to a secondary store. The automatic backup uses the integration of Azure Event Grid with App Configuration.
20
+
In this article, you'll learn how to set up an automatic backup of key-values from a primary Azure App Configuration store to a secondary store. The automatic backup uses the integration of Azure Event Grid with App Configuration.
21
21
22
-
After you set up the automatic backup, App Configuration will publish events to Azure Event Grid for any changes made to key-values in a configuration store. Event Grid supports a variety of Azure services from which users can subscribe to the events emitted whenever key-values are created, updated, or deleted.
22
+
After you set up the automatic backup, App Configuration will publish events to Azure Event Grid for any changes made to key-values in a configuration store. Event Grid supports various Azure services from which users can subscribe to the events emitted whenever key-values are created, updated, or deleted.
23
+
24
+
> [!IMPORTANT]
25
+
> Azure App Configuration added [geo-replication](./concept-geo-replication.md) support recently. You can enable replicas of your data across multiple locations for enhanced resiliency to regional outages. You can also leverage App Configuration provider libraries in your applications for [automatic failover](./howto-geo-replication.md#use-replicas). The geo-replication feature is currently under preview. It will be the recommended solution for high availability when the feature is generally available.
23
26
24
27
## Overview
25
28
26
-
In this article, you'll use Azure Queue storage to receive events from Event Grid and use a timer-trigger of Azure Functions to process events in the queue in batches.
29
+
In this article, you'll use Azure Queue storage to receive events from Event Grid and use a timer-trigger of Azure Functions to process events in the queue in batches.
27
30
28
31
When a function is triggered, based on the events, it will fetch the latest values of the keys that have changed from the primary App Configuration store and update the secondary store accordingly. This setup helps combine multiple changes that occur in a short period in one backup operation, which avoids excessive requests made to your App Configuration stores.
29
32
@@ -37,7 +40,7 @@ In this tutorial, you'll create a secondary store in the `centralus` region and
-[Visual Studio 2019](https://visualstudio.microsoft.com/vs) with the Azure development workload.
43
46
@@ -121,6 +124,7 @@ az eventgrid event-subscription create \
121
124
### Set up with ready-to-use functions
122
125
123
126
In this article, you'll work with C# functions that have the following properties:
127
+
124
128
- Runtime stack .NET Core 3.1
125
129
- Azure Functions runtime version 3.x
126
130
- Function triggered by timer every 10 minutes
@@ -134,6 +138,7 @@ To make it easier for you to start backing up your data, we've [tested and publi
134
138
### Build your own function
135
139
136
140
If the sample code provided earlier doesn't meet your requirements, you can also create your own function. Your function must be able to perform the following tasks in order to complete the backup:
141
+
137
142
- Periodically read contents of your queue to see if it contains any notifications from Event Grid. Refer to the [Storage Queue SDK](../storage/queues/storage-quickstart-queues-dotnet.md) for implementation details.
138
143
- If your queue contains [event notifications from Event Grid](./concept-app-configuration-event.md#event-schema), extract all the unique `<key, label>` information from event messages. The combination of key and label is the unique identifier for key-value changes in the primary store.
139
144
- Read all settings from the primary store. Update only those settings in the secondary store that have a corresponding event in the queue. Delete all settings from the secondary store that were present in the queue but not in the primary store. You can use the [App Configuration SDK](https://github.com/Azure/AppConfiguration#sdks) to access your configuration stores programmatically.
@@ -142,15 +147,14 @@ If the sample code provided earlier doesn't meet your requirements, you can also
142
147
143
148
To learn more about creating a function, see: [Create a function in Azure that is triggered by a timer](../azure-functions/functions-create-scheduled-function.md) and [Develop Azure Functions using Visual Studio](../azure-functions/functions-develop-vs.md).
144
149
145
-
146
150
> [!IMPORTANT]
147
151
> Use your best judgement to choose the timer schedule based on how often you make changes to your primary configuration store. Running the function too often might end up throttling requests for your store.
148
152
>
149
153
150
-
151
154
## Create function app settings
152
155
153
156
If you're using a function that we've provided, you need the following app settings in your function app:
157
+
154
158
-`PrimaryStoreEndpoint`: Endpoint for the primary App Configuration store. An example is `https://{primary_appconfig_name}.azconfig.io`.
155
159
-`SecondaryStoreEndpoint`: Endpoint for the secondary App Configuration store. An example is `https://{secondary_appconfig_name}.azconfig.io`.
156
160
-`StorageQueueUri`: Queue URI. An example is `https://{unique_storage_name}.queue.core.windows.net/{queue_name}`.
az functionapp config appsettings set --name $functionAppName --resource-group $resourceGroupName --settings StorageQueueUri=$storageQueueUri PrimaryStoreEndpoint=$primaryStoreEndpoint SecondaryStoreEndpoint=$secondaryStoreEndpoint
166
170
```
167
171
168
-
169
172
## Grant access to the managed identity of the function app
170
173
171
174
Use the following command or the [Azure portal](../app-service/overview-managed-identity.md#add-a-system-assigned-identity) to add a system-assigned managed identity for your function app.
> To perform the required resource creation and role management, your account needs `Owner` permissions at the appropriate scope (your subscription or resource group). If you need assistance with role assignment, learn [how to assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.md).
179
182
180
183
Use the following commands or the [Azure portal](./howto-integrate-azure-managed-service-identity.md#grant-access-to-app-configuration) to grant the managed identity of your function app access to your App Configuration stores. Use these roles:
184
+
181
185
- Assign the `App Configuration Data Reader` role in the primary App Configuration store.
182
186
- Assign the `App Configuration Data Owner` role in the secondary App Configuration store.
183
187
@@ -246,11 +250,11 @@ If you don't see the new setting in your secondary store:
246
250
- It's possible that Event Grid couldn't send the event notification to the queue in time. Check if your queue still contains the event notification from your primary store. If it does, trigger the backup function again.
247
251
- Check [Azure Functions logs](../azure-functions/functions-create-scheduled-function.md#test-the-function) for any errors or warnings.
248
252
- Use the [Azure portal](../azure-functions/functions-how-to-use-azure-function-app-settings.md#get-started-in-the-azure-portal) to ensure that the Azure function app contains correct values for the application settings that Azure Functions is trying to read.
249
-
- You can also set up monitoring and alerting for Azure Functions by using [Azure Application Insights](../azure-functions/functions-monitoring.md?tabs=cmd).
250
-
253
+
- You can also set up monitoring and alerting for Azure Functions by using [Azure Application Insights](../azure-functions/functions-monitoring.md?tabs=cmd).
251
254
252
255
## Clean up resources
253
-
If you plan to continue working with this App Configuration and event subscription, don't clean up the resources created in this article. If you don't plan to continue, use the following command to delete the resources created in this article.
256
+
257
+
If you plan to continue working with this App Configuration and event subscription, you might want to leave these resources in place. If you don't plan to continue, use the [az group delete](/cli/azure/group#az-group-delete) command, which deletes the resource group and the resources in it.
254
258
255
259
```azurecli-interactive
256
260
az group delete --name $resourceGroupName
@@ -260,4 +264,5 @@ az group delete --name $resourceGroupName
260
264
261
265
Now that you know how to set up automatic backup of your key-values, learn more about how you can increase the geo-resiliency of your application:
262
266
263
-
-[Resiliency and disaster recovery](concept-disaster-recovery.md)
267
+
> [!div class="nextstepaction"]
268
+
> [Resiliency and disaster recovery](concept-disaster-recovery.md)
0 commit comments