Shaunebu.Azure.AppConfiguration
1.0.1
dotnet add package Shaunebu.Azure.AppConfiguration --version 1.0.1
NuGet\Install-Package Shaunebu.Azure.AppConfiguration -Version 1.0.1
<PackageReference Include="Shaunebu.Azure.AppConfiguration" Version="1.0.1" />
<PackageVersion Include="Shaunebu.Azure.AppConfiguration" Version="1.0.1" />
<PackageReference Include="Shaunebu.Azure.AppConfiguration" />
paket add Shaunebu.Azure.AppConfiguration --version 1.0.1
#r "nuget: Shaunebu.Azure.AppConfiguration, 1.0.1"
#:package Shaunebu.Azure.AppConfiguration@1.0.1
#addin nuget:?package=Shaunebu.Azure.AppConfiguration&version=1.0.1
#tool nuget:?package=Shaunebu.Azure.AppConfiguration&version=1.0.1
Shaunebu.Azure.AppConfiguration 🌐✨
A flexible library for interacting with Azure App Configuration. Supports CRUD operations, key searches, multiple environments, and file serialization in JSON/XML.
🚀 Installation
Add the library to your project via NuGet:
dotnet add package Shaunebu.Azure.AppConfiguration
Reference: Azure App Configuration Documentation
⚡ Initialization
Initialize the service with your environment configurations (ConfigurationDto) and optionally set a default environment:
using Shaunebu.Azure.AppConfiguration.Models;
using Shaunebu.Azure.AppConfiguration.Services;
var configurations = new List<ConfigurationDto>()
{
new ConfigurationDto
{
Environment = "DEV",
AzureAppConfigConnectionString = "Endpoint=DEV_URL;Id=...;Secret=...",
JsonFileName = "Config-DEV.json",
XmlFileName = "Config-DEV.xml",
AllJsonFileName = "Config-All.json",
AllXmlFileName = "Config-All.xml"
},
new ConfigurationDto
{
Environment = "PROD",
AzureAppConfigConnectionString = "Endpoint=PROD_URL;Id=...;Secret=...",
JsonFileName = "Config-PROD.json",
XmlFileName = "Config-PROD.xml",
AllJsonFileName = "Config-All.json",
AllXmlFileName = "Config-All.xml"
}
};
// Initialize service
AppConfigurationService.Instance.Initialize(configurations, defaultEnvironment: "DEV");
🔑 Main Properties
| Property | Type | Description |
|---|---|---|
CurrentEnvironment |
string |
Default environment used if environment parameter is not passed |
_environments |
Dictionary<string, ConfigurationDto> |
Stores all initialized environments for the service |
🛠 CRUD Operations
📥 Get Configurations
| Method | Description | Default Behavior |
|---|---|---|
GetAllConfigurationByEnvironment() |
Get all settings for a single environment | Uses CurrentEnvironment |
GetAllConfigurations() |
Get all settings from all environments | Loops through _environments.Values |
var devConfigs = AppConfigurationService.Instance.GetAllConfigurationByEnvironment();
var allConfigs = AppConfigurationService.Instance.GetAllConfigurations();
🔍 Search Keys
| Method | Description |
|---|---|
SearchKeyByEnvironment(string key) |
Search for a key in a specific environment |
SearchKeyOnAllEnvironments(string key) |
Search for a key across all initialized environments |
var featureToggle = AppConfigurationService.Instance.SearchKeyOnAllEnvironments("FeatureToggle");
➕ Add Configurations
// Single key in CurrentEnvironment
AppConfigurationService.Instance.AddConfiguration("FeatureXEnabled", "true", "Features");
// Single key in PROD
AppConfigurationService.Instance.AddConfiguration("FeatureXEnabled", "true", "Features", environment: "PROD");
// Multiple keys
var keyValues = new Dictionary<string, object>
{
{ "Key1", "Value1" },
{ "Key2", "Value2" }
};
AppConfigurationService.Instance.AddConfigurations("MyLabel", keyValues, environment: "DEV");
✏️ Update Configurations
AppConfigurationService.Instance.UpdateConfiguration("FeatureXEnabled", "false", "Features");
AppConfigurationService.Instance.UpdateConfigurations("MyLabel", keyValues, environment: "PROD");
🗑 Delete Configurations
// Single key
AppConfigurationService.Instance.DeleteConfiguration("FeatureXEnabled", "Features");
// Multiple keys
AppConfigurationService.Instance.DeleteConfigurations("MyLabel", keyValues);
// Delete a section
AppConfigurationService.Instance.DeleteEntireConfigurationSection("Features", "FeatureX", environment: "PROD");
💾 Serialization & File Saving
Both GetAllConfigurationByEnvironment and GetAllConfigurations support JSON and XML output, optionally saving to disk:
var serialized = AppConfigurationService.Instance.GetAllConfigurationByEnvironment(
saveFile: true,
label: "MyLabel",
serialization: SerializationTypes.Json
);
| Option | Output |
|---|---|
SerializationTypes.Json |
.json file |
SerializationTypes.Xml |
.xml file |
File paths are configured per ConfigurationDto.
⚖️ Feature Comparison: Shaunebu.Azure.AppConfiguration vs Azure SDK
| Feature | Shaunebu.Azure.AppConfiguration 🌐 | Azure SDK Official ⚡ |
|---|---|---|
| Multiple environments support | ✅ Dynamically manage multiple environments via ConfigurationDto |
❌ Requires manual connection string management |
| CRUD operations | ✅ Add, Update, Delete, Get, Search, Delete Section | ✅ Basic CRUD |
| Key search across environments | ✅ SearchKeyOnAllEnvironments() |
❌ Must loop manually |
| Section deletion | ✅ DeleteEntireConfigurationSection() |
❌ Not provided natively |
| Serialization to files | ✅ JSON & XML | ❌ No built-in support |
| Lazy Singleton instance | ✅ AppConfigurationService.Instance |
❌ Must instantiate manually |
| Default/current environment | ✅ CurrentEnvironment property |
❌ No built-in default tracking |
| Multi-label queries | ✅ Supports label filtering easily | ✅ Supported but requires manual coding |
| File saving | ✅ Automatic saving to configured paths | ❌ Manual file operations needed |
| Decoupled from enums | ✅ Fully string-based environment keys | ❌ May require custom enums or constants |
Tip: Shaunebu.Azure.AppConfiguration is designed for multi-environment enterprise scenarios and simplifies working with Azure App Configuration without writing repetitive boilerplate code.
📌 Example Usage
// Initialize
AppConfigurationService.Instance.Initialize(configurations, "DEV");
// Get all settings for default environment
var devConfigs = AppConfigurationService.Instance.GetAllConfigurationByEnvironment();
// Search key across all environments
var keyResults = AppConfigurationService.Instance.SearchKeyOnAllEnvironments("FeatureToggle");
// Add a new key in PROD
AppConfigurationService.Instance.AddConfiguration("FeatureXEnabled", "true", "Features", "PROD");
// Update key in DEV
AppConfigurationService.Instance.UpdateConfiguration("FeatureXEnabled", "false", "Features");
// Delete key in CurrentEnvironment
AppConfigurationService.Instance.DeleteConfiguration("FeatureXEnabled", "Features");
🚀 Platform Support
Your library is compatible with multiple platforms thanks to .NET 6+ and the Azure.Data.AppConfiguration SDK:
| Platform | Support | Notes |
|---|---|---|
| 🖥 Windows | ✅ Full | Console, WPF, WinForms, MAUI |
| 🐧 Linux | ✅ Full | Console apps, APIs, microservices |
| 🍏 macOS | ✅ Full | Console apps, MAUI, Blazor |
| 📱 iOS | ✅ Full | MAUI apps, via backend proxy for connection strings |
| 🤖 Android | ✅ Full | MAUI apps, via backend proxy for connection strings |
| 🌐 Blazor Server | ✅ Full | Safe to use with secret keys |
| 🌐 Blazor WebAssembly | ⚠️ Partial | Avoid storing connection strings on client-side; use backend proxy |
| 🌐 ASP.NET / ASP.NET Core | ✅ Full | APIs, web apps, microservices |
✅ Advantages
Fully decoupled from enums like
EnvironmentTypesManage multiple environments dynamically
Full CRUD support, including key searches and section deletion
Supports serialization to JSON/XML and saving to disk
Designed for multi-environment enterprise scenarios
References:
Azure App Configuration Official Docs
Azure App Configuration SDK for .NET
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Azure.Core (>= 1.48.0)
- Azure.Data.AppConfiguration (>= 1.6.1)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.4)
-
net8.0
- Azure.Core (>= 1.48.0)
- Azure.Data.AppConfiguration (>= 1.6.1)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release with multi-environment support and CRUD operations for Azure App Configuration.