Skip to content

Commit 5d06696

Browse files
Merge pull request #248462 from amerjusupovic/ajusupovic/snapshots-dotnet
Add .NET provider snapshot documentation
2 parents 70da685 + 0aa28eb commit 5d06696

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

articles/azure-app-configuration/howto-create-snapshots.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,38 @@ To create sample snapshots and check how the snapshots feature work, use the sna
8686
1. Select **Create** to generate the sample snapshot.
8787
1. Check out the snapshot result generated under **Generated sample snapshot**. The sample snapshot displays all keys that are included in the sample snapshot, according to your selection.
8888

89+
## Use snapshots
90+
91+
You can select any number of snapshots for the application's configuration. Selecting a snapshot adds all of its key-values. Once added to a configuration, the key-values from snapshots are treated the same as any other key-value.
92+
93+
If you have an application using Azure App Configuration, you can update it with the following sample code to use snapshots. You only need to provide the name of the snapshot, which is case-sensitive.
94+
95+
### [.NET](#tab/dotnet)
96+
97+
Edit the call to the `AddAzureAppConfiguration` method, which is often found in the `program.cs` file of your application. If you don't have an application, you can reference any of the .NET quickstart guides, like [creating an ASP.NET core app with Azure App Configuration](./quickstart-aspnet-core-app.md).
98+
99+
**Add snapshots to your configuration**
100+
101+
```csharp
102+
configurationBuilder.AddAzureAppConfiguration(options =>
103+
{
104+
options.Connect(Environment.GetEnvironmentVariable("ConnectionString"));
105+
106+
// Select an existing snapshot by name. This will add all of the key-values from the snapshot to this application's configuration.
107+
options.SelectSnapshot("SnapshotName");
108+
109+
// Other changes to options
110+
});
111+
```
112+
113+
> [!NOTE]
114+
> Snapshot support is available if you use version **7.0.0-preview** or later of any of the following packages.
115+
> - `Microsoft.Extensions.Configuration.AzureAppConfiguration`
116+
> - `Microsoft.Azure.AppConfiguration.AspNetCore`
117+
> - `Microsoft.Azure.AppConfiguration.Functions.Worker`
118+
119+
---
120+
89121
## Manage active snapshots
90122

91123
The page under **Operations** > **Snapshots (preview)** displays two tabs: **Active snapshots** and **Archived snapshots**. Select **Active snapshots** to view the list of all active snapshots in an App Configuration store.

0 commit comments

Comments
 (0)