Registry /
azure / azure-mgmt-apimanagement
Install & Compatibility
Where this runs
tested against v5.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.876s · 58.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.6s · import 0.774s · 59MB
59MB installed
● package 59MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ApiManagementClient
✓ from azure.mgmt.apimanagement import ApiManagementClient
DefaultAzureCredential
✓ from azure.identity import DefaultAzureCredential
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]
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.apimanagement import ApiManagementClient
# Set environment variables or replace with your actual values
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET must be set for DefaultAzureCredential
# AZURE_SUBSCRIPTION_ID is also required for the client
subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID')
# Authenticate and create API Management client
try:
credential = DefaultAzureCredential()
client = ApiManagementClient(credential, subscription_id)
print(f"Successfully authenticated for subscription: {subscription_id}")
# List all API Management services in the subscription
print("Listing API Management services...")
for service in client.api_management_service.list():
print(f" - Name: {service.name}, Location: {service.location}, SKU: {service.sku.name}")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure AZURE_SUBSCRIPTION_ID and Azure authentication environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET) are correctly set.")
Debug
Known issues
breakingStarting 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]fixUpdate `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]
affects: < 3.0.0 (when targeting API versions < 2021-08-01)
breakingTrusted 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]fixConsult Azure documentation for migration guidance related to trusted service connectivity retirement. [12]
affects: All versions if your API Management service relies on this feature.
gotcha`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]fixEnsure `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]
affects: All versions using `azure-identity` for authentication.
breakingVersion 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]fixReview the release notes for version 5.0.0 and update client calls to leverage the new operation groups and their methods where applicable. [1]
affects: Transitioning from `azure-mgmt-apimanagement` < 5.0.0 to 5.0.0+
Upgrade
Version history
5.0.0latest on PyPI · released Apr 22, 2025
Audit
Dependencies
pythonrequiredRequired Python version
azure-identityrequiredUsed for Azure Active Directory token authentication
azure-mgmt-coreoptionalCommon dependency for Azure management libraries
azure-commonoptionalCommon dependency for Azure libraries
isodateoptionalDependency for date/time parsing