Skip to content

Commit

Permalink
Merge pull request Azure#5304 from maririos/docs
Browse files Browse the repository at this point in the history
[AppConfig] Add documentation to SDK
  • Loading branch information
maririos authored Mar 7, 2019
2 parents bcb70fc + 67184c7 commit 4f4d633
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Enable Tests against Live Server

1. Get [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)
## Prerequisites
- Get [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)
- Have an [Azure subscription](https://docs.microsoft.com/azure/guides/developer/azure-developer-guide#understanding-accounts-subscriptions-and-billing). More information about how to create a [free account](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).

Run:
## Usage
Create or use an existing [Configuration Store](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-dotnet-core-app#create-an-app-configuration-store).

2. `az login`
3. `az extension add --source https://azconfigextensions.blob.core.windows.net/azconfigextension/azconfig-0.3.0-py2.py3-none-any.whl`
4. `az azconfig credential list -n azconfig`
For users that have access to the `Azure SDK Developer Playground` subscription, run:
1. `az login`
2. `az extension add --source https://azconfigextensions.blob.core.windows.net/azconfigextension/azconfig-0.3.0-py2.py3-none-any.whl`
3. `az azconfig credential list -n azconfig`

**Note**: If you see the error similar to: `InvalidResourceNamespace - The resource namespace 'Microsoft.Azconfig' is invalid.` make sure to add the subscription `Azure SDK Developer Playground` as your active subscription. To do this:
1. Check your active subscription value by doing `az account show`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,50 @@
# Overview

Azure.ApplicationModel.Configuration is a component of the .NET Azure SDK.
It provides APIs for storing and retrieving application settings.
It provides APIs for Microsoft [Azure's Application Configuration Service](https://docs.microsoft.com/en-us/azure/azure-app-configuration/) which is a service that allows to easily store and manage all application settings in one central place that is separated from code.

Developers can use this SDK to interact with the [Configuration Store](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-dotnet-core-app#create-an-app-configuration-store) where the configuration settings are stored.

Actions that can be executed are:

- Perform basic reads, writes, updates, and deletes of an application configuration settings.
- Get the history of a configuration setting.
- Watch for changes in a specific configuration setting.

# Installing

A NuGet package called Azure.ApplicationModel.Configuration will be avaliable soon.

# Configuration Setting
Is the fundamental resource within a Configuration Store. In its simplest form it is a key and a value. However, there are additional properties such as the modifiable content type and tags fields that allow the value to be interpreted or associated in different ways.

The Label property of a configuration setting provides a way to separate configuration settings into different dimensions. These dimensions are user defined and can take any form. Some common examples of dimensions to use for a label include regions, semantic versions, or environments. Many applications have a required set of configuration keys that have varying values as the application exists across different dimensions.
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, in the "WestEurope" label, a solution can be achieved that allows the application to seamlessly retrieve configuration settings as it runs in these two dimensions.

Properties of a Configuration Setting:

```c#
string Key { get; set; }

string Label { get; set; }

string Value { get; set; }

string ContentType { get; set; }

string ETag { get; }

DateTimeOffset LastModified { get; }

bool Locked { get; }

IDictionary<string, string> Tags { get; set; }
```

# Hello World
The following example demonstrates how to initialize a ConfigurationClient and perform a basic operations in the Configuration Store.

To begin using ConfigurationClient, a connection string must be provided which specifies the configuration store endpoint and credentials to use when sending requests. This conneection string can be retrieved by the Azure Portal or by using the [Azure CLI](https://docs.microsoft.com/en-us/azure/azure-app-configuration/cli-samples). From that point, the example uses the client to set, retrieve and delete a configuration setting by its name.

```c#
public async Task HelloWorld()
Expand Down Expand Up @@ -40,6 +77,7 @@ public async Task HelloWorld()
2. [How to configure retry policy](https://github.com/Azure/azure-sdk-for-net/tree/master/src/SDKs/Azure.ApplicationModel.Configuration/data-plane/Azure.Configuration.Tests/samples/Sample6_ConfiguringRetries.cs)
3. [How to configure service requests](https://github.com/Azure/azure-sdk-for-net/tree/master/src/SDKs/Azure.ApplicationModel.Configuration/data-plane/Azure.Configuration.Tests/samples/Sample7_ConfiguringPipeline.cs)

[More...](https://github.com/Azure/azure-sdk-for-net/blob/master/src/SDKs/Azure.ApplicationModel.Configuration/data-plane/Azure.Configuration.Tests/ConfigurationLiveTests.cs)

# Contributing
If the changes you are working on span both Azure.Base and Azure.Configuration then you can set this environment variable before launching Visual Studio. That will use Project To Project references between Azure.Configuration and Azure.Base instead of package references.
Expand Down

0 comments on commit 4f4d633

Please sign in to comment.