CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-appconfiguration

Microsoft Azure App Configuration Management Client Library for Python

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

configuration-stores.mddocs/

Configuration Store Operations

The ConfigurationStoresOperations class provides comprehensive management capabilities for Azure App Configuration stores, including creation, deletion, updates, key management, and soft delete operations.

Operations Class

class ConfigurationStoresOperations:
    """
    Operations for managing Azure App Configuration stores.
    
    This class provides methods for the complete lifecycle management of App Configuration stores,
    including provisioning, configuration updates, access key management, and deletion with
    soft delete and recovery capabilities.
    """

Store Lifecycle Management

List Configuration Stores

def list(
    self, 
    skip_token: Optional[str] = None, 
    **kwargs: Any
) -> ItemPaged[ConfigurationStore]:
    """
    Lists all App Configuration stores within a subscription.
    
    Args:
        skip_token: A skip token to retrieve the next set of results, if any.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        ItemPaged[ConfigurationStore]: A paged collection of configuration stores.
        
    Example:
        >>> stores = client.configuration_stores.list()
        >>> for store in stores:
        ...     print(f"{store.name}: {store.provisioning_state}")
    """
def list_by_resource_group(
    self, 
    resource_group_name: str, 
    skip_token: Optional[str] = None, 
    **kwargs: Any
) -> ItemPaged[ConfigurationStore]:
    """
    Lists App Configuration stores within a specific resource group.
    
    Args:
        resource_group_name: The name of the resource group.
        skip_token: A skip token to retrieve the next set of results, if any.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        ItemPaged[ConfigurationStore]: A paged collection of configuration stores in the resource group.
        
    Example:
        >>> stores = client.configuration_stores.list_by_resource_group("my-rg")
        >>> print(f"Found {len(list(stores))} stores in resource group")
    """

Get Configuration Store

def get(
    self, 
    resource_group_name: str, 
    config_store_name: str, 
    **kwargs: Any
) -> ConfigurationStore:
    """
    Gets the properties of an App Configuration store.
    
    Args:
        resource_group_name: The name of the resource group containing the store.
        config_store_name: The name of the configuration store.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        ConfigurationStore: The configuration store details.
        
    Raises:
        HttpResponseError: If the store is not found or access is denied.
        
    Example:
        >>> store = client.configuration_stores.get("my-rg", "my-store")
        >>> print(f"Store endpoint: {store.endpoint}")
        >>> print(f"Store SKU: {store.sku.name}")
    """

Create Configuration Store

def begin_create(
    self, 
    resource_group_name: str, 
    config_store_name: str, 
    config_store_creation_parameters: ConfigurationStore, 
    **kwargs: Any
) -> LROPoller[ConfigurationStore]:
    """
    Creates a new App Configuration store with the specified parameters.
    
    Args:
        resource_group_name: The name of the resource group.
        config_store_name: The name of the configuration store (5-50 characters, alphanumeric and hyphens).
        config_store_creation_parameters: Configuration store creation parameters.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        LROPoller[ConfigurationStore]: A poller for the long-running create operation.
        
    Example:
        >>> from azure.mgmt.appconfiguration.models import ConfigurationStore, Sku
        >>> store_params = ConfigurationStore(
        ...     location="East US",
        ...     sku=Sku(name="Free"),
        ...     tags={"Environment": "Production"}
        ... )
        >>> poller = client.configuration_stores.begin_create(
        ...     "my-rg", "my-store", store_params
        ... )
        >>> store = poller.result()  # Wait for completion
    """

Update Configuration Store

def begin_update(
    self, 
    resource_group_name: str, 
    config_store_name: str, 
    config_store_update_parameters: ConfigurationStoreUpdateParameters, 
    **kwargs: Any
) -> LROPoller[ConfigurationStore]:
    """
    Updates the properties of an existing App Configuration store.
    
    Args:
        resource_group_name: The name of the resource group.
        config_store_name: The name of the configuration store.
        config_store_update_parameters: Configuration store update parameters.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        LROPoller[ConfigurationStore]: A poller for the long-running update operation.
        
    Example:
        >>> from azure.mgmt.appconfiguration.models import ConfigurationStoreUpdateParameters
        >>> update_params = ConfigurationStoreUpdateParameters(
        ...     tags={"Environment": "Production", "Team": "DevOps"},
        ...     sku=Sku(name="Standard")
        ... )
        >>> poller = client.configuration_stores.begin_update(
        ...     "my-rg", "my-store", update_params
        ... )
        >>> updated_store = poller.result()
    """

Delete Configuration Store

def begin_delete(
    self, 
    resource_group_name: str, 
    config_store_name: str, 
    **kwargs: Any
) -> LROPoller[None]:
    """
    Deletes an App Configuration store. The store enters a soft-deleted state.
    
    Args:
        resource_group_name: The name of the resource group.
        config_store_name: The name of the configuration store.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        LROPoller[None]: A poller for the long-running delete operation.
        
    Note:
        Deleted stores enter a soft-deleted state and can be recovered within the retention period.
        Use purge_deleted() to permanently delete a store.
        
    Example:
        >>> poller = client.configuration_stores.begin_delete("my-rg", "my-store")
        >>> poller.wait()  # Wait for deletion to complete
        >>> print("Store deleted (soft delete)")
    """

Access Key Management

List Access Keys

def list_keys(
    self, 
    resource_group_name: str, 
    config_store_name: str, 
    skip_token: Optional[str] = None, 
    **kwargs: Any
) -> ItemPaged[ApiKey]:
    """
    Lists the access keys for an App Configuration store.
    
    Args:
        resource_group_name: The name of the resource group.
        config_store_name: The name of the configuration store.
        skip_token: A skip token to retrieve the next set of results, if any.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        ItemPaged[ApiKey]: A paged collection of API keys for the store.
        
    Example:
        >>> keys = client.configuration_stores.list_keys("my-rg", "my-store")
        >>> for key in keys:
        ...     print(f"Key: {key.name}, Read-only: {key.read_only}")
        ...     print(f"Connection string: {key.connection_string}")
    """

Regenerate Access Key

def regenerate_key(
    self, 
    resource_group_name: str, 
    config_store_name: str, 
    regenerate_key_parameters: RegenerateKeyParameters, 
    **kwargs: Any
) -> ApiKey:
    """
    Regenerates an access key for an App Configuration store.
    
    Args:
        resource_group_name: The name of the resource group.
        config_store_name: The name of the configuration store.
        regenerate_key_parameters: Parameters for key regeneration.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        ApiKey: The regenerated API key with new connection string.
        
    Example:
        >>> from azure.mgmt.appconfiguration.models import RegenerateKeyParameters
        >>> regen_params = RegenerateKeyParameters(id="key-id")
        >>> new_key = client.configuration_stores.regenerate_key(
        ...     "my-rg", "my-store", regen_params
        ... )
        >>> print(f"New connection string: {new_key.connection_string}")
    """

Soft Delete Management

List Deleted Stores

def list_deleted(self, **kwargs: Any) -> ItemPaged[DeletedConfigurationStore]:
    """
    Lists all soft-deleted App Configuration stores in the subscription.
    
    Args:
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        ItemPaged[DeletedConfigurationStore]: A paged collection of deleted configuration stores.
        
    Example:
        >>> deleted_stores = client.configuration_stores.list_deleted()
        >>> for store in deleted_stores:
        ...     print(f"Deleted store: {store.name}")
        ...     print(f"Deletion date: {store.deletion_date}")
        ...     print(f"Scheduled purge date: {store.scheduled_purge_date}")
    """

Get Deleted Store

def get_deleted(
    self, 
    location: str, 
    config_store_name: str, 
    **kwargs: Any
) -> DeletedConfigurationStore:
    """
    Gets the properties of a soft-deleted App Configuration store.
    
    Args:
        location: The location where the store was deleted.
        config_store_name: The name of the deleted configuration store.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        DeletedConfigurationStore: The deleted configuration store details.
        
    Example:
        >>> deleted_store = client.configuration_stores.get_deleted(
        ...     "eastus", "my-deleted-store"
        ... )
        >>> print(f"Can be recovered until: {deleted_store.scheduled_purge_date}")
    """

Purge Deleted Store

def begin_purge_deleted(
    self, 
    location: str, 
    config_store_name: str, 
    **kwargs: Any
) -> LROPoller[None]:
    """
    Permanently deletes (purges) a soft-deleted App Configuration store.
    
    Args:
        location: The location where the store was deleted.
        config_store_name: The name of the deleted configuration store.
        **kwargs: Additional keyword arguments for the request.
        
    Returns:
        LROPoller[None]: A poller for the long-running purge operation.
        
    Warning:
        This operation is irreversible. The store and all its data will be permanently lost.
        
    Example:
        >>> poller = client.configuration_stores.begin_purge_deleted(
        ...     "eastus", "my-deleted-store"
        ... )
        >>> poller.wait()  # Wait for purge to complete
        >>> print("Store permanently deleted")
    """

Practical Usage Examples

Complete Store Creation Workflow

from azure.mgmt.appconfiguration import AppConfigurationManagementClient
from azure.mgmt.appconfiguration.models import (
    ConfigurationStore, 
    Sku, 
    PublicNetworkAccess,
    EncryptionProperties,
    KeyVaultProperties
)
from azure.identity import DefaultAzureCredential

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

# Create store with advanced configuration
store_params = ConfigurationStore(
    location="East US",
    sku=Sku(name="Standard"),
    tags={
        "Environment": "Production",
        "Team": "Platform", 
        "CostCenter": "Engineering"
    },
    public_network_access=PublicNetworkAccess.ENABLED,
    # Optional: Configure customer-managed encryption
    encryption=EncryptionProperties(
        key_vault_properties=KeyVaultProperties(
            key_identifier="https://myvault.vault.azure.net/keys/mykey",
            identity_client_id="client-id-of-managed-identity"
        )
    )
)

# Create the store
print("Creating App Configuration store...")
create_poller = client.configuration_stores.begin_create(
    resource_group_name="my-resource-group",
    config_store_name="my-production-store",
    config_store_creation_parameters=store_params
)

# Monitor progress
while not create_poller.done():
    print("Store creation in progress...")
    time.sleep(10)

# Get the created store
store = create_poller.result()
print(f"Store created successfully!")
print(f"Name: {store.name}")
print(f"Endpoint: {store.endpoint}")
print(f"Provisioning State: {store.provisioning_state}")

Key Rotation Workflow

from azure.mgmt.appconfiguration.models import RegenerateKeyParameters

# List current keys
print("Current access keys:")
keys = client.configuration_stores.list_keys("my-rg", "my-store")
key_list = list(keys)

for key in key_list:
    print(f"Key ID: {key.id}")
    print(f"Name: {key.name}")
    print(f"Read-only: {key.read_only}")
    print(f"Last modified: {key.last_modified}")
    print("---")

# Regenerate the primary key (typically the first non-read-only key)
primary_key = next(key for key in key_list if not key.read_only)
print(f"Regenerating key: {primary_key.name}")

regen_params = RegenerateKeyParameters(id=primary_key.id)
new_key = client.configuration_stores.regenerate_key(
    "my-rg", "my-store", regen_params
)

print(f"Key regenerated successfully!")
print(f"New connection string: {new_key.connection_string}")

Soft Delete Recovery Workflow

# Check for deleted stores that can be recovered
print("Checking for recoverable stores...")
deleted_stores = client.configuration_stores.list_deleted()

for store in deleted_stores:
    print(f"Deleted store: {store.name}")
    print(f"Original location: {store.location}")
    print(f"Deletion date: {store.deletion_date}")
    print(f"Scheduled purge: {store.scheduled_purge_date}")
    
    # Check if store can still be recovered
    import datetime
    if store.scheduled_purge_date > datetime.datetime.now(datetime.timezone.utc):
        print(f"✓ Store '{store.name}' can be recovered")
        
        # To recover, create a new store with the same name and CreateMode.RECOVER
        from azure.mgmt.appconfiguration.models import CreateMode
        recovery_params = ConfigurationStore(
            location=store.location,
            sku=Sku(name="Standard"),  # Must specify SKU for recovery
            create_mode=CreateMode.RECOVER
        )
        
        print(f"Recovering store '{store.name}'...")
        recover_poller = client.configuration_stores.begin_create(
            store.resource_group,
            store.name,
            recovery_params
        )
        recovered_store = recover_poller.result()
        print(f"Store recovered successfully: {recovered_store.endpoint}")
    else:
        print(f"✗ Store '{store.name}' is past recovery period")

Store Monitoring and Management

# Get comprehensive store information
def get_store_summary(resource_group: str, store_name: str):
    # Get store details
    store = client.configuration_stores.get(resource_group, store_name)
    
    print(f"=== Store Summary: {store.name} ===")
    print(f"Resource Group: {resource_group}")
    print(f"Location: {store.location}")
    print(f"SKU: {store.sku.name}")
    print(f"Provisioning State: {store.provisioning_state}")
    print(f"Creation Date: {store.creation_date}")
    print(f"Endpoint: {store.endpoint}")
    print(f"Public Network Access: {store.public_network_access}")
    
    # List access keys
    print("\nAccess Keys:")
    keys = client.configuration_stores.list_keys(resource_group, store_name)
    for key in keys:
        key_type = "Read-Write" if not key.read_only else "Read-Only" 
        print(f"  - {key.name} ({key_type})")
    
    # Check for replicas
    replicas = client.replicas.list_by_configuration_store(resource_group, store_name)
    replica_count = len(list(replicas))
    print(f"Replicas: {replica_count}")
    
    # Check for private endpoints
    private_endpoints = client.private_endpoint_connections.list_by_configuration_store(
        resource_group, store_name
    )
    pe_count = len(list(private_endpoints))
    print(f"Private Endpoints: {pe_count}")
    
    if store.tags:
        print("Tags:")
        for key, value in store.tags.items():
            print(f"  {key}: {value}")

# Usage
get_store_summary("my-resource-group", "my-store")

Asynchronous Operations

All operations are available in asynchronous versions:

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

async def async_store_operations():
    credential = DefaultAzureCredential()
    async with AppConfigurationManagementClient(credential, "subscription-id") as client:
        # List stores asynchronously
        stores = client.configuration_stores.list()
        async for store in stores:
            print(f"Store: {store.name}")
            
        # Create store asynchronously
        store_params = ConfigurationStore(location="East US", sku=Sku(name="Free"))
        create_poller = await client.configuration_stores.begin_create(
            "my-rg", "async-store", store_params
        )
        store = await create_poller.result()
        print(f"Created: {store.name}")

# Run the async function
import asyncio
asyncio.run(async_store_operations())

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-appconfiguration

docs

configuration-stores.md

index.md

key-values.md

models-and-types.md

operations.md

private-networking.md

replicas.md

snapshots.md

tile.json