or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration-stores.mdindex.mdkey-values.mdmodels-and-types.mdoperations.mdprivate-networking.mdreplicas.mdsnapshots.md
tile.json

tessl/pypi-azure-mgmt-appconfiguration

Microsoft Azure App Configuration Management Client Library for Python

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-appconfiguration@5.0.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-appconfiguration@5.0.0

index.mddocs/

Azure App Configuration Management Client Library for Python

The azure-mgmt-appconfiguration package provides a comprehensive client library for managing Azure App Configuration resources through the Azure Resource Manager (ARM) APIs. This library enables you to programmatically create, configure, and manage Azure App Configuration stores, their key-value pairs, replicas, snapshots, and networking configurations.

Package Information

  • Package: azure-mgmt-appconfiguration
  • Version: 5.0.0
  • API Version: 2024-06-01
  • Repository: Azure SDK for Python

Core Imports

Synchronous Client

from azure.mgmt.appconfiguration import AppConfigurationManagementClient
from azure.identity import DefaultAzureCredential

# Initialize client
credential = DefaultAzureCredential()
client = AppConfigurationManagementClient(
    credential=credential,
    subscription_id="your-subscription-id"
)

Asynchronous Client

from azure.mgmt.appconfiguration.aio import AppConfigurationManagementClient
from azure.identity.aio import DefaultAzureCredential

# Initialize async client
credential = DefaultAzureCredential()
async_client = AppConfigurationManagementClient(
    credential=credential,
    subscription_id="your-subscription-id"
)

Basic Usage Example

from azure.mgmt.appconfiguration import AppConfigurationManagementClient
from azure.mgmt.appconfiguration.models import ConfigurationStore, Sku
from azure.identity import DefaultAzureCredential

# Authenticate and create client
credential = DefaultAzureCredential()
client = AppConfigurationManagementClient(credential, "your-subscription-id")

# Create a new App Configuration store
store_params = ConfigurationStore(
    location="East US",
    sku=Sku(name="Free"),
    tags={"Environment": "Development"}
)

# Start the create operation (Long Running Operation)
create_poller = client.configuration_stores.begin_create(
    resource_group_name="my-resource-group",
    config_store_name="my-config-store",
    config_store_creation_parameters=store_params
)

# Wait for completion and get result
config_store = create_poller.result()
print(f"Created store: {config_store.name} at {config_store.endpoint}")

# List all stores in subscription
stores = client.configuration_stores.list()
for store in stores:
    print(f"Store: {store.name} in {store.location}")

Client Architecture

The AppConfigurationManagementClient provides access to seven primary operations groups, each handling specific aspects of Azure App Configuration management:

AppConfigurationManagementClient

class AppConfigurationManagementClient:
    def __init__(
        self, 
        credential: TokenCredential, 
        subscription_id: str, 
        base_url: Optional[str] = None, 
        **kwargs: Any
    ) -> None:
        """
        Initialize the App Configuration Management Client.
        
        Args:
            credential: Azure credential for authentication
            subscription_id: Azure subscription ID
            base_url: Service URL (defaults to Azure Resource Manager endpoint)
            **kwargs: Additional keyword arguments for client configuration
        """

Operations Groups

The client exposes the following operations groups as properties:

Core Capabilities

Configuration Store Management

Comprehensive lifecycle management of Azure App Configuration stores:

# List stores across subscription
stores = client.configuration_stores.list()

# Get specific store details
store = client.configuration_stores.get("resource-group", "store-name")

# Update store configuration
from azure.mgmt.appconfiguration.models import ConfigurationStoreUpdateParameters
update_params = ConfigurationStoreUpdateParameters(
    tags={"Environment": "Production", "Team": "DevOps"}
)
update_poller = client.configuration_stores.begin_update(
    "resource-group", "store-name", update_params
)
updated_store = update_poller.result()

→ See complete Configuration Store Operations

Key-Value Management

Direct management of configuration key-value pairs through the ARM API:

from azure.mgmt.appconfiguration.models import KeyValue

# Create or update a key-value pair
key_value = KeyValue(value="production-value", content_type="text/plain")
result = client.key_values.create_or_update(
    resource_group_name="resource-group",
    config_store_name="store-name", 
    key_value_name="MyApp:Settings:DatabaseUrl",
    key_value_parameters=key_value
)

# Retrieve a key-value
kv = client.key_values.get("resource-group", "store-name", "MyApp:Settings:DatabaseUrl")
print(f"Value: {kv.value}, Content-Type: {kv.content_type}")

→ See complete Key-Value Operations

Private Networking

Secure your App Configuration stores with private endpoints and private link resources:

# List private endpoint connections
connections = client.private_endpoint_connections.list_by_configuration_store(
    "resource-group", "store-name"
)

# List available private link resources
link_resources = client.private_link_resources.list_by_configuration_store(
    "resource-group", "store-name"
)

for resource in link_resources:
    print(f"Group: {resource.group_id}, Required members: {resource.required_members}")

→ See complete Private Networking Operations

Replica Management

Scale your configuration across regions with replicas:

from azure.mgmt.appconfiguration.models import Replica

# Create a replica in another region
replica_params = Replica(location="West US")
create_replica_poller = client.replicas.begin_create(
    resource_group_name="resource-group",
    config_store_name="store-name",
    replica_name="west-us-replica", 
    replica_creation_parameters=replica_params
)
replica = create_replica_poller.result()

# List all replicas for a store
replicas = client.replicas.list_by_configuration_store("resource-group", "store-name")
for replica in replicas:
    print(f"Replica: {replica.name} in {replica.location}")

→ See complete Replica Management

Snapshot Management

Create point-in-time snapshots of your configuration:

from azure.mgmt.appconfiguration.models import Snapshot, KeyValueFilter, CompositionType

# Create a snapshot with specific filters
filters = [KeyValueFilter(key="MyApp:*")]
snapshot_params = Snapshot(
    filters=filters,
    composition_type=CompositionType.KEY,
    retention_period=7776000  # 90 days in seconds
)

create_snapshot_poller = client.snapshots.begin_create(
    resource_group_name="resource-group",
    config_store_name="store-name",
    snapshot_name="prod-config-snapshot",
    snapshot_creation_parameters=snapshot_params
)
snapshot = create_snapshot_poller.result()

→ See complete Snapshot Operations

Authentication and Credentials

The library supports all Azure Identity credential types:

from azure.identity import (
    DefaultAzureCredential,
    ClientSecretCredential,
    ManagedIdentityCredential,
    AzureCliCredential
)

# Default credential (recommended for most scenarios)
credential = DefaultAzureCredential()

# Service principal with client secret
credential = ClientSecretCredential(
    tenant_id="tenant-id",
    client_id="client-id", 
    client_secret="client-secret"
)

# Managed Identity (for Azure services)
credential = ManagedIdentityCredential()

# Azure CLI credential
credential = AzureCliCredential()

Error Handling

The library provides comprehensive error models for handling API errors:

from azure.core.exceptions import HttpResponseError
from azure.mgmt.appconfiguration.models import ErrorResponse

try:
    store = client.configuration_stores.get("resource-group", "non-existent-store")
except HttpResponseError as e:
    print(f"HTTP {e.status_code}: {e.reason}")
    if hasattr(e, 'error') and e.error:
        print(f"Error code: {e.error.code}")
        print(f"Error message: {e.error.message}")

Long Running Operations

Many operations are asynchronous and return LROPoller objects:

from azure.core.polling import LROPoller

# Start a long-running operation
poller = client.configuration_stores.begin_create(resource_group, store_name, params)

# Check if operation is complete
if not poller.done():
    print("Operation is still in progress...")

# Wait for completion with custom polling interval
result = poller.result(timeout=300)  # Wait up to 5 minutes

# Or poll manually
while not poller.done():
    time.sleep(30)  # Wait 30 seconds between checks
    print("Still waiting...")

Paged Results

List operations return ItemPaged objects for efficient handling of large result sets:

from azure.core.paging import ItemPaged

# Get paged results
paged_stores = client.configuration_stores.list()

# Iterate through all pages automatically
for store in paged_stores:
    print(store.name)

# Manual page iteration
for page in paged_stores.by_page():
    for store in page:
        print(f"Store: {store.name} in {store.location}")

Additional Resources

Context Manager Support

Both synchronous and asynchronous clients support context managers:

# Synchronous context manager
with AppConfigurationManagementClient(credential, subscription_id) as client:
    stores = client.configuration_stores.list()
    for store in stores:
        print(store.name)
# Client automatically closed

# Asynchronous context manager  
async with AppConfigurationManagementClient(credential, subscription_id) as client:
    stores = client.configuration_stores.list()
    async for store in stores:
        print(store.name)
# Client automatically closed