{"id":9540,"library":"azure-mgmt-kubernetesconfiguration","title":"Azure Kubernetes Configuration Management","description":"The Microsoft Azure Kubernetes Configuration Management Client Library for Python provides functionality to manage Kubernetes configurations, including source control configurations, flux configurations, and extensions on Azure-managed Kubernetes clusters. It is part of the broader Azure SDK for Python, currently at version 3.1.0, and follows a consistent release cadence with other Azure SDKs, receiving regular updates and bug fixes.","status":"active","version":"3.1.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration","tags":["azure","kubernetes","management","sdk","configuration"],"install":[{"cmd":"pip install azure-mgmt-kubernetesconfiguration","lang":"bash","label":"Install library"}],"dependencies":[{"reason":"Required for authentication with Azure services using modern credential types like DefaultAzureCredential.","package":"azure-identity"},{"reason":"Fundamental shared utilities for all Azure SDKs, including HTTP pipelines and error handling.","package":"azure-core"},{"reason":"Shared utilities and base classes for Azure management SDKs, providing common functionality.","package":"azure-mgmt-core"}],"imports":[{"note":"The primary client class is directly exposed at the top level of the package for convenience. Importing from internal submodules like `kubernetes_configuration_client` is not the recommended or stable path.","wrong":"from azure.mgmt.kubernetesconfiguration.kubernetes_configuration_client import KubernetesConfigurationClient","symbol":"KubernetesConfigurationClient","correct":"from azure.mgmt.kubernetesconfiguration import KubernetesConfigurationClient"},{"note":"`DefaultAzureCredential` is the recommended and modern way to authenticate with Azure services, automatically trying various methods. Direct use of older credential types like `ServicePrincipalCredentials` is largely deprecated or specialized.","wrong":"from azure.common.credentials import ServicePrincipalCredentials","symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.kubernetesconfiguration import KubernetesConfigurationClient\n\n# Set your Azure Subscription ID as an environment variable (AZURE_SUBSCRIPTION_ID)\n# or replace os.environ.get with your actual subscription ID string.\nsubscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID')\n\nif not subscription_id or subscription_id == 'YOUR_SUBSCRIPTION_ID':\n    raise ValueError(\n        \"Please set the AZURE_SUBSCRIPTION_ID environment variable or replace 'YOUR_SUBSCRIPTION_ID'.\"\n    )\n\n# Authenticate using DefaultAzureCredential.\n# This will try several authentication methods, including Azure CLI, Azure Developer CLI,\n# environment variables, and Managed Identity if applicable.\ncredential = DefaultAzureCredential()\n\n# Create a KubernetesConfigurationClient instance\nclient = KubernetesConfigurationClient(credential, subscription_id)\n\nprint(f\"Listing operations for Kubernetes Configuration in subscription {subscription_id}:\")\n\ntry:\n    # List all available operations related to Kubernetes Configuration.\n    # This is a common and safe way to test client connectivity and permissions without\n    # requiring specific resource names.\n    operations = client.operations.list()\n\n    # Iterate and print basic details of each operation\n    for op in operations:\n        print(f\"- {op.display.provider}/{op.display.resource}: {op.display.operation}\")\n\n    print(\"Quickstart example completed successfully.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure your subscription ID is correct and you have appropriate permissions.\")","lang":"python","description":"This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and instantiate the `KubernetesConfigurationClient`. It then lists all available operations for Kubernetes Configuration, which serves as a basic connectivity and permission test. Ensure your `AZURE_SUBSCRIPTION_ID` environment variable is set or replace the placeholder, and you are authenticated to Azure (e.g., via `az login`)."},"warnings":[{"fix":"Always review the official Azure SDK for Python changelog and migration guides for `azure-mgmt-kubernetesconfiguration` when upgrading. Update your code to reflect any new client instantiation patterns, method parameters, or data model changes.","message":"Major version updates (e.g., from 2.x to 3.x) often introduce breaking changes due to underlying Azure API version changes or significant SDK design updates. Client constructors, method signatures, and model schemas can change.","severity":"breaking","affected_versions":"<3.0.0 to 3.x.x"},{"fix":"Ensure you are authenticated to Azure (`az login` via Azure CLI is a common method) or that the necessary `AZURE_`-prefixed environment variables are correctly configured for service principal authentication. Consult the `azure-identity` documentation for credential precedence details.","message":"`DefaultAzureCredential` might fail to find credentials if environment variables (like `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) are not set, or if you are not logged in via Azure CLI/VS Code.","severity":"gotcha","affected_versions":"All versions using `azure-identity`"},{"fix":"Refer to the Azure REST API documentation for the specific Kubernetes resource type you are managing to correctly identify the required parameters and their exact values. Verify the resource type's `cluster_rp` and associated resource names carefully.","message":"Resource-specific operations often require precise `cluster_rp`, `cluster_resource_name`, and `cluster_name` parameters. `cluster_rp` (Resource Provider) can be confusing and specific to the Kubernetes distribution (e.g., 'Microsoft.ContainerService' for AKS, 'Microsoft.Kubernetes' for Arc-enabled clusters).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure you are authenticated to Azure (e.g., `az login` via Azure CLI), or that required environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` for service principal) are correctly set and have the necessary role assignments (e.g., Contributor or specific resource roles) on your Azure subscription.","cause":"The `DefaultAzureCredential` could not find valid credentials in any of its supported locations (environment variables, Azure CLI, Managed Identity, etc.) or the found credentials lack necessary permissions.","error":"azure.core.exceptions.ClientAuthenticationError: Authentication failed: 'DefaultAzureCredential' cannot retrieve credentials. ... Please check the troubleshooting guide for more information."},{"fix":"Verify that the resource names and IDs (e.g., `resource_group_name`, `cluster_name`) used in your code exactly match existing resources in your Azure subscription. Double-check for typos and ensure the specified resource exists in the correct region/resource group.","cause":"The resource ID (e.g., resource group name, cluster name, or other identifier) provided to a client method does not correspond to an existing resource in your Azure subscription or the API path is incorrect.","error":"azure.core.exceptions.ResourceNotFoundError: The resource with name 'my-non-existent-cluster' was not found."},{"fix":"Ensure the client is initialized correctly, providing both the credential object and the Azure subscription ID, like: `client = KubernetesConfigurationClient(credential, subscription_id)`.","cause":"The `KubernetesConfigurationClient` constructor requires a `subscription_id` in addition to the credential object, and it was omitted or passed incorrectly.","error":"TypeError: __init__ missing 1 required positional argument: 'subscription_id'"}]}