{"id":1805,"library":"azure-mgmt-apimanagement","title":"Microsoft Azure API Management Client Library for Python","description":"The Azure API Management Client Library for Python provides programmatic control over Azure API Management (APIM) resources. It enables developers and DevOps engineers to create, update, and manage APIM services, APIs, products, subscriptions, and policies. Currently at version 5.0.0, it is actively maintained as part of the Azure SDK for Python, with a regular release cadence.","status":"active","version":"5.0.0","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["Azure","API Management","Cloud","Microsoft","SDK","Management"],"install":[{"cmd":"pip install azure-mgmt-apimanagement azure-identity","lang":"bash","label":"Install package and authentication library"}],"dependencies":[{"reason":"Required Python version","package":"python","version":">=3.8","optional":false},{"reason":"Used for Azure Active Directory token authentication","package":"azure-identity","optional":false},{"reason":"Common dependency for Azure management libraries","package":"azure-mgmt-core","optional":true},{"reason":"Common dependency for Azure libraries","package":"azure-common","optional":true},{"reason":"Dependency for date/time parsing","package":"isodate","optional":true}],"imports":[{"symbol":"ApiManagementClient","correct":"from azure.mgmt.apimanagement import ApiManagementClient"},{"symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.apimanagement import ApiManagementClient\n\n# Set environment variables or replace with your actual values\n# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET must be set for DefaultAzureCredential\n# AZURE_SUBSCRIPTION_ID is also required for the client\nsubscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID')\n\n# Authenticate and create API Management client\ntry:\n    credential = DefaultAzureCredential()\n    client = ApiManagementClient(credential, subscription_id)\n    print(f\"Successfully authenticated for subscription: {subscription_id}\")\n\n    # List all API Management services in the subscription\n    print(\"Listing API Management services...\")\n    for service in client.api_management_service.list():\n        print(f\"  - Name: {service.name}, Location: {service.location}, SKU: {service.sku.name}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure AZURE_SUBSCRIPTION_ID and Azure authentication environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET) are correctly set.\")","lang":"python","description":"Initializes the `ApiManagementClient` using `DefaultAzureCredential` and lists all API Management services within the specified Azure subscription. Ensure your Azure authentication environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET) and AZURE_SUBSCRIPTION_ID are set for `DefaultAzureCredential` to work correctly. [1, 2, 7]"},"warnings":[{"fix":"Update `azure-mgmt-apimanagement` to version 3.0.0 or later and ensure your calls target API version 2021-08-01 or later in your service definitions or client initialization. [23]","message":"Starting June 1, 2024, all Azure API Management service API versions prior to 2021-08-01 are being retired (disabled). Management operations (creation, update, etc.) using older API versions via this SDK will fail. Data plane operations (API gateway) are unaffected. [23]","severity":"breaking","affected_versions":"< 3.0.0 (when targeting API versions < 2021-08-01)"},{"fix":"Consult Azure documentation for migration guidance related to trusted service connectivity retirement. [12]","message":"Trusted service connectivity in API Management gateway will be retired on March 15, 2026. Review Azure guidance to determine if your API Management service is affected. [12]","severity":"breaking","affected_versions":"All versions if your API Management service relies on this feature."},{"fix":"Ensure `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, and `AZURE_SUBSCRIPTION_ID` environment variables are correctly set for `DefaultAzureCredential` to function. [1, 2, 7]","message":"`DefaultAzureCredential` relies on specific environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`) for token authentication. Misconfiguration of these variables is a common source of authorization errors. [1, 2, 7]","severity":"gotcha","affected_versions":"All versions using `azure-identity` for authentication."},{"fix":"Review the release notes for version 5.0.0 and update client calls to leverage the new operation groups and their methods where applicable. [1]","message":"Version 5.0.0 introduced several new operation groups (e.g., `api_gateway`, `api_management_gateway_skus`, `all_policies`). Existing code interacting with these areas in previous versions may require updates to use the new client methods and structures. [1]","severity":"breaking","affected_versions":"Transitioning from `azure-mgmt-apimanagement` < 5.0.0 to 5.0.0+"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}