refactor: flatten Microsoft skills from nested to flat directory structure
Rewrote sync_microsoft_skills.py (v4) to use each SKILL.md's frontmatter 'name' field as the flat directory name under skills/, replacing the nested skills/official/microsoft/<lang>/<category>/<service>/ hierarchy. This fixes CI failures caused by the indexing, validation, and catalog scripts expecting skills/<id>/SKILL.md (depth 1). Changes: - Rewrite scripts/sync_microsoft_skills.py for flat output with collision detection - Update scripts/tests/inspect_microsoft_repo.py for flat name mapping - Update scripts/tests/test_comprehensive_coverage.py for name uniqueness checks - Delete skills/official/ nested directory - Add 129 Microsoft skills as flat directories (e.g. skills/azure-mgmt-botservice-dotnet/) - Move attribution files to docs/ (LICENSE-MICROSOFT, microsoft-skills-attribution.json) - Rebuild skills_index.json, CATALOG.md, README.md (845 total skills)
This commit is contained in:
249
skills/azure-appconfiguration-py/SKILL.md
Normal file
249
skills/azure-appconfiguration-py/SKILL.md
Normal file
@@ -0,0 +1,249 @@
|
||||
---
|
||||
name: azure-appconfiguration-py
|
||||
description: |
|
||||
Azure App Configuration SDK for Python. Use for centralized configuration management, feature flags, and dynamic settings.
|
||||
Triggers: "azure-appconfiguration", "AzureAppConfigurationClient", "feature flags", "configuration", "key-value settings".
|
||||
package: azure-appconfiguration
|
||||
---
|
||||
|
||||
# Azure App Configuration SDK for Python
|
||||
|
||||
Centralized configuration management with feature flags and dynamic settings.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install azure-appconfiguration
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
```bash
|
||||
AZURE_APPCONFIGURATION_CONNECTION_STRING=Endpoint=https://<name>.azconfig.io;Id=...;Secret=...
|
||||
# Or for Entra ID:
|
||||
AZURE_APPCONFIGURATION_ENDPOINT=https://<name>.azconfig.io
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
### Connection String
|
||||
|
||||
```python
|
||||
from azure.appconfiguration import AzureAppConfigurationClient
|
||||
|
||||
client = AzureAppConfigurationClient.from_connection_string(
|
||||
os.environ["AZURE_APPCONFIGURATION_CONNECTION_STRING"]
|
||||
)
|
||||
```
|
||||
|
||||
### Entra ID
|
||||
|
||||
```python
|
||||
from azure.appconfiguration import AzureAppConfigurationClient
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
client = AzureAppConfigurationClient(
|
||||
base_url=os.environ["AZURE_APPCONFIGURATION_ENDPOINT"],
|
||||
credential=DefaultAzureCredential()
|
||||
)
|
||||
```
|
||||
|
||||
## Configuration Settings
|
||||
|
||||
### Get Setting
|
||||
|
||||
```python
|
||||
setting = client.get_configuration_setting(key="app:settings:message")
|
||||
print(f"{setting.key} = {setting.value}")
|
||||
```
|
||||
|
||||
### Get with Label
|
||||
|
||||
```python
|
||||
# Labels allow environment-specific values
|
||||
setting = client.get_configuration_setting(
|
||||
key="app:settings:message",
|
||||
label="production"
|
||||
)
|
||||
```
|
||||
|
||||
### Set Setting
|
||||
|
||||
```python
|
||||
from azure.appconfiguration import ConfigurationSetting
|
||||
|
||||
setting = ConfigurationSetting(
|
||||
key="app:settings:message",
|
||||
value="Hello, World!",
|
||||
label="development",
|
||||
content_type="text/plain",
|
||||
tags={"environment": "dev"}
|
||||
)
|
||||
|
||||
client.set_configuration_setting(setting)
|
||||
```
|
||||
|
||||
### Delete Setting
|
||||
|
||||
```python
|
||||
client.delete_configuration_setting(
|
||||
key="app:settings:message",
|
||||
label="development"
|
||||
)
|
||||
```
|
||||
|
||||
## List Settings
|
||||
|
||||
### All Settings
|
||||
|
||||
```python
|
||||
settings = client.list_configuration_settings()
|
||||
for setting in settings:
|
||||
print(f"{setting.key} [{setting.label}] = {setting.value}")
|
||||
```
|
||||
|
||||
### Filter by Key Prefix
|
||||
|
||||
```python
|
||||
settings = client.list_configuration_settings(
|
||||
key_filter="app:settings:*"
|
||||
)
|
||||
```
|
||||
|
||||
### Filter by Label
|
||||
|
||||
```python
|
||||
settings = client.list_configuration_settings(
|
||||
label_filter="production"
|
||||
)
|
||||
```
|
||||
|
||||
## Feature Flags
|
||||
|
||||
### Set Feature Flag
|
||||
|
||||
```python
|
||||
from azure.appconfiguration import ConfigurationSetting
|
||||
import json
|
||||
|
||||
feature_flag = ConfigurationSetting(
|
||||
key=".appconfig.featureflag/beta-feature",
|
||||
value=json.dumps({
|
||||
"id": "beta-feature",
|
||||
"enabled": True,
|
||||
"conditions": {
|
||||
"client_filters": []
|
||||
}
|
||||
}),
|
||||
content_type="application/vnd.microsoft.appconfig.ff+json;charset=utf-8"
|
||||
)
|
||||
|
||||
client.set_configuration_setting(feature_flag)
|
||||
```
|
||||
|
||||
### Get Feature Flag
|
||||
|
||||
```python
|
||||
setting = client.get_configuration_setting(
|
||||
key=".appconfig.featureflag/beta-feature"
|
||||
)
|
||||
flag_data = json.loads(setting.value)
|
||||
print(f"Feature enabled: {flag_data['enabled']}")
|
||||
```
|
||||
|
||||
### List Feature Flags
|
||||
|
||||
```python
|
||||
flags = client.list_configuration_settings(
|
||||
key_filter=".appconfig.featureflag/*"
|
||||
)
|
||||
for flag in flags:
|
||||
data = json.loads(flag.value)
|
||||
print(f"{data['id']}: {'enabled' if data['enabled'] else 'disabled'}")
|
||||
```
|
||||
|
||||
## Read-Only Settings
|
||||
|
||||
```python
|
||||
# Make setting read-only
|
||||
client.set_read_only(
|
||||
configuration_setting=setting,
|
||||
read_only=True
|
||||
)
|
||||
|
||||
# Remove read-only
|
||||
client.set_read_only(
|
||||
configuration_setting=setting,
|
||||
read_only=False
|
||||
)
|
||||
```
|
||||
|
||||
## Snapshots
|
||||
|
||||
### Create Snapshot
|
||||
|
||||
```python
|
||||
from azure.appconfiguration import ConfigurationSnapshot, ConfigurationSettingFilter
|
||||
|
||||
snapshot = ConfigurationSnapshot(
|
||||
name="v1-snapshot",
|
||||
filters=[
|
||||
ConfigurationSettingFilter(key="app:*", label="production")
|
||||
]
|
||||
)
|
||||
|
||||
created = client.begin_create_snapshot(
|
||||
name="v1-snapshot",
|
||||
snapshot=snapshot
|
||||
).result()
|
||||
```
|
||||
|
||||
### List Snapshot Settings
|
||||
|
||||
```python
|
||||
settings = client.list_configuration_settings(
|
||||
snapshot_name="v1-snapshot"
|
||||
)
|
||||
```
|
||||
|
||||
## Async Client
|
||||
|
||||
```python
|
||||
from azure.appconfiguration.aio import AzureAppConfigurationClient
|
||||
from azure.identity.aio import DefaultAzureCredential
|
||||
|
||||
async def main():
|
||||
credential = DefaultAzureCredential()
|
||||
client = AzureAppConfigurationClient(
|
||||
base_url=endpoint,
|
||||
credential=credential
|
||||
)
|
||||
|
||||
setting = await client.get_configuration_setting(key="app:message")
|
||||
print(setting.value)
|
||||
|
||||
await client.close()
|
||||
await credential.close()
|
||||
```
|
||||
|
||||
## Client Operations
|
||||
|
||||
| Operation | Description |
|
||||
|-----------|-------------|
|
||||
| `get_configuration_setting` | Get single setting |
|
||||
| `set_configuration_setting` | Create or update setting |
|
||||
| `delete_configuration_setting` | Delete setting |
|
||||
| `list_configuration_settings` | List with filters |
|
||||
| `set_read_only` | Lock/unlock setting |
|
||||
| `begin_create_snapshot` | Create point-in-time snapshot |
|
||||
| `list_snapshots` | List all snapshots |
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Use labels** for environment separation (dev, staging, prod)
|
||||
2. **Use key prefixes** for logical grouping (app:database:*, app:cache:*)
|
||||
3. **Make production settings read-only** to prevent accidental changes
|
||||
4. **Create snapshots** before deployments for rollback capability
|
||||
5. **Use Entra ID** instead of connection strings in production
|
||||
6. **Refresh settings periodically** in long-running applications
|
||||
7. **Use feature flags** for gradual rollouts and A/B testing
|
||||
Reference in New Issue
Block a user