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
@@ -29,14 +25,14 @@ Use the client library for App Configuration to:
29
25
30
26
Install the Azure App Configuration client library for .NET with [NuGet][nuget]:
31
27
32
-
```PowerShell
33
-
Install-Package Azure.Data.AppConfiguration
28
+
```dotnetcli
29
+
dotnet add package Azure.Data.AppConfiguration
34
30
```
35
31
36
-
### Prerequisites
32
+
### Prerequisites
37
33
38
34
* An [Azure subscription][azure_sub].
39
-
* An existing [Configuration Store][configuration_store].
35
+
* An existing [Configuration Store][configuration_store].
40
36
41
37
If you need to create a Configuration Store, you can use the Azure Portal or [Azure CLI][azure_cli].
42
38
@@ -74,8 +70,8 @@ var client = new ConfigurationClient(connectionString);
74
70
Client subscription key authentication is used in most of the examples in this getting started guide, but you can also authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. To use the [DefaultAzureCredential][azure_identity_dac] provider shown below,
75
71
or other credential providers provided with the Azure SDK, please install the Azure.Identity package:
76
72
77
-
```PowerShell
78
-
Install-Package Azure.Identity
73
+
```dotnetcli
74
+
dotnet add package Azure.Identity
79
75
```
80
76
81
77
You will also need to [register a new AAD application][aad_register_app] and [grant access][aad_grant_access] to Configuration Store by assigning the `"App Configuration Data Reader"` or `"App Configuration Data Owner"` role to your service principal.
@@ -98,34 +94,35 @@ The [Label][label_concept] property of a Configuration Setting provides a way to
98
94
For example, MaxRequests may be 100 in "NorthAmerica" and 200 in "WestEurope". By creating a Configuration Setting named MaxRequests with a label of "NorthAmerica" and another, only with a different value, with a "WestEurope" label, an application can seamlessly retrieve Configuration Settings as it runs in these two dimensions.
99
95
100
96
### Thread safety
97
+
101
98
We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.
[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) |
[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.1/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) |
The following sections provide several code snippets covering some of the most common Configuration Service tasks. Note that there are sync and async methods available for both.
117
114
118
-
-[Create a Configuration Setting](#create-a-configuration-setting)
119
-
-[Retrieve a Configuration Setting](#retrieve-a-configuration-setting)
120
-
-[Update an existing Configuration Setting](#update-an-existing-configuration-setting)
121
-
-[Delete a Configuration Setting](#delete-a-configuration-setting)
115
+
*[Create a Configuration Setting](#create-a-configuration-setting)
116
+
*[Retrieve a Configuration Setting](#retrieve-a-configuration-setting)
117
+
*[Update an existing Configuration Setting](#update-an-existing-configuration-setting)
118
+
*[Delete a Configuration Setting](#delete-a-configuration-setting)
122
119
123
120
### Create a Configuration Setting
124
121
125
122
Create a Configuration Setting to be stored in the Configuration Store. There are two ways to store a Configuration Setting:
126
123
127
-
- AddConfigurationSetting creates a setting only if the setting does not already exist in the store.
128
-
- SetConfigurationSetting creates a setting if it doesn't exist or overrides an existing setting.
124
+
* AddConfigurationSetting creates a setting only if the setting does not already exist in the store.
125
+
* SetConfigurationSetting creates a setting if it doesn't exist or overrides an existing setting.
When you interact with Azure App Configuration using the .NET SDK, errors returned by the service correspond to the same HTTP status codes returned for [REST API][azconfig_rest] requests.
170
-
171
-
For example, if you try to retrieve a Configuration Setting that doesn't exist in your Configuration Store, a `404` error is returned, indicating `Not Found`.
See our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.AppConfiguration_1.2.1/sdk/appconfiguration/Azure.Data.AppConfiguration/TROUBLESHOOTING.md) for details on how to diagnose various failure scenarios.
194
167
195
168
## Next steps
196
169
197
170
### More sample code
198
171
199
-
Several App Configuration client library samples are available to you in this GitHub repository. These include:
200
-
-[Hello world](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample1_HelloWorld.md): Create and delete a configuration setting.
201
-
-[Hello world async with labels](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample2_HelloWorldExtended.md): Asynchronously create, update and delete configuration settings with labels.
202
-
-[Make a configuration setting readonly](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample3_SetClearReadOnly.md): Make a configuration setting read-only, and then return it to a read-write state.
203
-
-[Read revision history](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample4_ReadRevisionHistory.md): Read the revision history of a configuration setting that has been changed.
204
-
-[Get a setting if changed](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample5_GetSettingIfChanged.md): Save bandwidth by using a conditional request to retrieve a setting only if it is different from your local copy.
205
-
-[Update a setting if it hasn't changed](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample6_UpdateSettingIfUnchanged.md): Prevent lost updates by using optimistic concurrency to update a setting only if your local updates were applied to the same version as the resource in the configuration store.
206
-
-[Create a mock client](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.0/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample7_MockClient.md): Mock a client for testing using the [Moq library][moq].
172
+
Several App Configuration client library samples are available to you in this GitHub repository. These include:
207
173
208
-
For more details see the [samples README][samples_readme].
174
+
*[Hello world](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.1/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample1_HelloWorld.md): Create and delete a configuration setting.
175
+
*[Hello world async with labels](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.1/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample2_HelloWorldExtended.md): Asynchronously create, update and delete configuration settings with labels.
176
+
*[Make a configuration setting readonly](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.1/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample3_SetClearReadOnly.md): Make a configuration setting read-only, and then return it to a read-write state.
177
+
*[Read revision history](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.1/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample4_ReadRevisionHistory.md): Read the revision history of a configuration setting that has been changed.
178
+
*[Get a setting if changed](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.1/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample5_GetSettingIfChanged.md): Save bandwidth by using a conditional request to retrieve a setting only if it is different from your local copy.
179
+
*[Update a setting if it hasn't changed](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Data.AppConfiguration_1.2.1/sdk/appconfiguration/Azure.Data.AppConfiguration/samples/Sample6_UpdateSettingIfUnchanged.md): Prevent lost updates by using optimistic concurrency to update a setting only if your local updates were applied to the same version as the resource in the configuration store.
180
+
*[Create a mock client](https://learn.microsoft.com/dotnet/azure/sdk/unit-testing-mocking): Mock a client for testing.
209
181
182
+
For more details see the [samples README][samples_readme].
210
183
211
184
## Contributing
212
185
@@ -221,28 +194,25 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
0 commit comments