|
Add this skill
npx mdskills install sickn33/azure-appconfiguration-pyComprehensive SDK reference with clear examples, but lacks agent-specific instructions and triggers
1---2name: azure-appconfiguration-py3description: |4 Azure App Configuration SDK for Python. Use for centralized configuration management, feature flags, and dynamic settings.5 Triggers: "azure-appconfiguration", "AzureAppConfigurationClient", "feature flags", "configuration", "key-value settings".6package: azure-appconfiguration7---89# Azure App Configuration SDK for Python1011Centralized configuration management with feature flags and dynamic settings.1213## Installation1415```bash16pip install azure-appconfiguration17```1819## Environment Variables2021```bash22AZURE_APPCONFIGURATION_CONNECTION_STRING=Endpoint=https://<name>.azconfig.io;Id=...;Secret=...23# Or for Entra ID:24AZURE_APPCONFIGURATION_ENDPOINT=https://<name>.azconfig.io25```2627## Authentication2829### Connection String3031```python32from azure.appconfiguration import AzureAppConfigurationClient3334client = AzureAppConfigurationClient.from_connection_string(35 os.environ["AZURE_APPCONFIGURATION_CONNECTION_STRING"]36)37```3839### Entra ID4041```python42from azure.appconfiguration import AzureAppConfigurationClient43from azure.identity import DefaultAzureCredential4445client = AzureAppConfigurationClient(46 base_url=os.environ["AZURE_APPCONFIGURATION_ENDPOINT"],47 credential=DefaultAzureCredential()48)49```5051## Configuration Settings5253### Get Setting5455```python56setting = client.get_configuration_setting(key="app:settings:message")57print(f"{setting.key} = {setting.value}")58```5960### Get with Label6162```python63# Labels allow environment-specific values64setting = client.get_configuration_setting(65 key="app:settings:message",66 label="production"67)68```6970### Set Setting7172```python73from azure.appconfiguration import ConfigurationSetting7475setting = ConfigurationSetting(76 key="app:settings:message",77 value="Hello, World!",78 label="development",79 content_type="text/plain",80 tags={"environment": "dev"}81)8283client.set_configuration_setting(setting)84```8586### Delete Setting8788```python89client.delete_configuration_setting(90 key="app:settings:message",91 label="development"92)93```9495## List Settings9697### All Settings9899```python100settings = client.list_configuration_settings()101for setting in settings:102 print(f"{setting.key} [{setting.label}] = {setting.value}")103```104105### Filter by Key Prefix106107```python108settings = client.list_configuration_settings(109 key_filter="app:settings:*"110)111```112113### Filter by Label114115```python116settings = client.list_configuration_settings(117 label_filter="production"118)119```120121## Feature Flags122123### Set Feature Flag124125```python126from azure.appconfiguration import ConfigurationSetting127import json128129feature_flag = ConfigurationSetting(130 key=".appconfig.featureflag/beta-feature",131 value=json.dumps({132 "id": "beta-feature",133 "enabled": True,134 "conditions": {135 "client_filters": []136 }137 }),138 content_type="application/vnd.microsoft.appconfig.ff+json;charset=utf-8"139)140141client.set_configuration_setting(feature_flag)142```143144### Get Feature Flag145146```python147setting = client.get_configuration_setting(148 key=".appconfig.featureflag/beta-feature"149)150flag_data = json.loads(setting.value)151print(f"Feature enabled: {flag_data['enabled']}")152```153154### List Feature Flags155156```python157flags = client.list_configuration_settings(158 key_filter=".appconfig.featureflag/*"159)160for flag in flags:161 data = json.loads(flag.value)162 print(f"{data['id']}: {'enabled' if data['enabled'] else 'disabled'}")163```164165## Read-Only Settings166167```python168# Make setting read-only169client.set_read_only(170 configuration_setting=setting,171 read_only=True172)173174# Remove read-only175client.set_read_only(176 configuration_setting=setting,177 read_only=False178)179```180181## Snapshots182183### Create Snapshot184185```python186from azure.appconfiguration import ConfigurationSnapshot, ConfigurationSettingFilter187188snapshot = ConfigurationSnapshot(189 name="v1-snapshot",190 filters=[191 ConfigurationSettingFilter(key="app:*", label="production")192 ]193)194195created = client.begin_create_snapshot(196 name="v1-snapshot",197 snapshot=snapshot198).result()199```200201### List Snapshot Settings202203```python204settings = client.list_configuration_settings(205 snapshot_name="v1-snapshot"206)207```208209## Async Client210211```python212from azure.appconfiguration.aio import AzureAppConfigurationClient213from azure.identity.aio import DefaultAzureCredential214215async def main():216 credential = DefaultAzureCredential()217 client = AzureAppConfigurationClient(218 base_url=endpoint,219 credential=credential220 )221222 setting = await client.get_configuration_setting(key="app:message")223 print(setting.value)224225 await client.close()226 await credential.close()227```228229## Client Operations230231| Operation | Description |232|-----------|-------------|233| `get_configuration_setting` | Get single setting |234| `set_configuration_setting` | Create or update setting |235| `delete_configuration_setting` | Delete setting |236| `list_configuration_settings` | List with filters |237| `set_read_only` | Lock/unlock setting |238| `begin_create_snapshot` | Create point-in-time snapshot |239| `list_snapshots` | List all snapshots |240241## Best Practices2422431. **Use labels** for environment separation (dev, staging, prod)2442. **Use key prefixes** for logical grouping (app:database:*, app:cache:*)2453. **Make production settings read-only** to prevent accidental changes2464. **Create snapshots** before deployments for rollback capability2475. **Use Entra ID** instead of connection strings in production2486. **Refresh settings periodically** in long-running applications2497. **Use feature flags** for gradual rollouts and A/B testing250
Full transparency — inspect the skill content before installing.